Unbreakable
Unbreakable

Reputation: 8122

WCF hosting on IIS throwing Exception (Don't have Permission and HTTP Error 404.3 - Not Found)

Exception:

You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.

I am learning WCF for the first time and I am trying to host it on IIS. I am a complete beginner so I might have done any silly mistakes.

Running WCF from Visual Studio:

I am able to open the WSDL document and able to browse when I run locally.

enter image description here

Now when I add this as a website in IIS Manager I get the exception mentioned above.

enter image description here enter image description here enter image description here

Config File:

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
     <behaviors>
  <serviceBehaviors>
    <behavior name="mexBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="mexBehavior" name="WSHttpService.WSHttpService">
    <endpoint address="WSHttpService" binding="wsHttpBinding" contract="WSHttpService.IWSHttpService" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8080" />
      </baseAddresses>
    </host>
  </service>
</services>
  </system.serviceModel>
  <system.web>
    <compilation debug="true"/>
  </system.web>
</configuration>

enter image description here

enter image description here

Microsoft is known for displaying errors which are totally misguiding. Please some one help me as I might be doing some other silly mistake.

Solution I looked into SO Link

Upvotes: 0

Views: 760

Answers (2)

Unbreakable
Unbreakable

Reputation: 8122

  1. I had to add TWO USERS IUSR and IIS_IUSRS and give all the permissions
  2. After making above changes I started getting a different exception

HTTP Error 404.3 - Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Detailed Error Information

Solution:

Go to Control Panel -> Windows Feature turn on/off and there apply below config.

enter image description here

Upvotes: 1

user2908532
user2908532

Reputation: 21

A few things to check. Make sure your IIS user account has permissions to view the folder where your code lives.

I would change the bindings to basic http until you can get IIS responding as you would expect.

Also, if your hosting in iis vs an iisExpress host, the "add baseAddress="http://localhost:8080" " will have an effect on how IIS tries to service the endpoint.

Upvotes: 0

Related Questions