When browsing a WCF Web site I receive the Error "Web Page cannot be found"
One of this days I got a complaining from one colleague where he was trying to setup an BizTalk Environment where they need to deploy a couple of WCF Services in one of the Servers.
Accordingly with them they created this new Server and installed the WCF Services on IIS without any issues (right :-)).
After this they did all the BizTalk configuration part on the other Servers, but when they start connecting their BizTalk Instrumentations with the WCF Services they started to see a lot of errors.
After some testing, they resolved to go directly to the Server where the WCF Services were installed and they tried to browse locally the WCF Service, and there that were they see this very helpful Error Message: "Web page cannot be found"
Trying to help this was what I did, first stop was looking at the IIS logs (of course, right?), there we could see Errors that shed a little more light to issue itself, we saw the below Errors being registered: "HTTP Status Code : 405 - Method Not Allowed" .
Still, we do not had a clear idea about what's going on, so next stop was, lets activate WCF Traces.
So, did all the process of activating WCF Traces on the config files, tried again and surprisingly (or not) no log files were written at all.
Ok, so at that point I kind of suspecting that the issue was not on the WCF Service itself but rather on the IIS pipeline since the Request were not even reaching the WCF Pipeline (no WCF Traces were being written means that the Request were not reaching).
Based on the above, we tried a very simple test, basically we created a simple ASPX page on the Website in question and tried to browse it, that worked.
So that told me that this should be related with the handler that needed to be invoked to process the WCF Service Request was not registered (despite the fact that it was installed).
So, the next step was obviously trying to re-register the WCF Service handlers, so we run the bellow command:
C:\Windows\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation\ Servicemodelreg.exe -i
And voila, now when we try to browse the WCF Service locally it works, when we try to browse the WCF Service remotely it works and when we start the BizTalk Instrumentations they work now without any issues at all.
Just to finish a little bit more information about this "Service Model Registration Tool (ServiceModelReg.exe)".
This command-line tool provides the ability to manage the registration of WCF and WF components on a single machine. Under normal circumstances you should not need to use this tool as WCF and WF components are configured when installed.
But if you are experiencing problems with service activation, you can try to register the components using this tool.
Hope that helps