I have a .NET 3.5 based web service running at http://localhost/serivce.svc/. Then I have an ASP.NET application running at http://localhost/myApp. In Application_Load my application reads some XML configuration from the web service. That works fine on my machine, but:
- On Windows Vista with IIS 7 the request to the web services fails.
- The web service can be accessed via the browser without any problem.
- I configured the app pool of my application to run as admin. I added the admin to the IIS_USRS group, but it still cannot access the web service.
impersonate=true/falseseems not to make a difference.
First off, take admin out of the IIS_WPG group before you forget, and configure your app pool back to normal.
Now, turn on WCF logging on the service by putting the following in your web.config file –
Create the c:\logs directory and make sure the application pool identity user has full control on that directory. Now test your app.
If no log files are being created then there’s a problem reaching the WCF service.
If log files are being created view them in the Service Trace viewer which comes as part of the Windows SDK. You’ll see a red message which is the log entry containing the exception thrown inside the service – this should give you a pointer to where your service code is going wrong.
If the problem is inside your app, rather than the service then you should be logging exceptions inside your
Application_Loadevent (you should be logging exceptions anyway) – however if you try with a global exception handler, well, your app is failing on startup and so the global exception handler will never start to run – instead of putting potential failable scenarios inApplication_LoadI’d move that out to a utility class which provides an access point to the information you need (say myGlobalThingumy.GetStuff()). Make this class a singleton, and then check if you have the stuff already – if you don’t, then you make your web service call. It would act much the same as putting it inApplication_Loadbut will enable global error handling to work, and make your debugging easier.