Friday, June 12, 2015

WCF on IIS: configure permissions

I modified my WCF service to get/set data from a SQL database, in order to make it a usefull service. And after adding the functions i needed i debugged it and everything looked fine. But then upon uploading it to my IIS server i was unable to get access.

The problem was inadequate permissions, and so i started down a long road of error checking.

First off all i checked these two off my list:

  • Newcomer advice 1: Install WCF support for IIS
  • Newcomer advice 2: Add the service as an application in IIS Manager


Having done those the first step i had to do was changing the permissions to use the ApplicationPool:
After doing this i was allowed to view my site, or at least the non descriptive error messages it gave me.


The second step i did was change my web.config a little, so i could get descriptive error messages:

Now I could see there was something wrong with my SQL permissions, as IIS APPPOOL\ASP.NET v4.5 was denied access. So next step was to open SQL Management Studio and add this name as a user:


After adding the user, and setting my table 'arbeidslog' as the default for the user i added the permission 'db_owner' on the User Mapping dialog. (Security -> Logins -> IIS APPPOOL\ASP.NET v4.5)

And that was it, Service is now spitting JSON from my database just like it's supposed to.

No comments:

Post a Comment