Thursday, June 26, 2014

Working through the dreaded Internal Server Error 500

I just split my huge WCF endpoint into five parts and renamed them. Everything works great in Visual Studio but when I publish to a development server and try the run the application I get the following error when I try to instantiate a connection to the endpoints...

The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)


This is a very generic error, even by Microsoft's standards, which can mean that IIS had a problem starting my service or that an unhandled error occurred in my service.

I started by turning the Failed Request module on in IIS and generating the error again. If you look in Inetpub/logs/FailedReqLogFiles/W3SVC1 you will see many XML files. Open the last one for a very detailed look at the request that failed. The summary of mine looks like this...


As you can see "The operation completed successful" isn't very useful.

Moving on, we try to call the service directly from Internet Explorer from the server itself (not the client machine) with the URL http://it77624/WCFDatabase/Database.svc and we get the following error.

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

After Googling this error I remembered that I had changed the application names on the WCF Server from DatabaseWCF to WCFDatabase etc. You have to put the  new applications in the 4.0 or 4.5 Classic application pool.

Move the applications for the WCF endpoints into a Classic application pool

No comments:

Post a Comment