0

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

Unbreakable
  • 7,776
  • 24
  • 90
  • 171

2 Answers2

1
  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

Unbreakable
  • 7,776
  • 24
  • 90
  • 171
  • 1
    This one is helpful specially for new developer join a existing wcf service project and their machine is still in new status. They would possible face this issue. Since by default, the window operation system doesn't included above mentioned options under WCF Services checkbox. Thank you. – ChinaHelloWorld Jan 24 '18 at 18:56
0

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.

user2908532
  • 21
  • 1
  • 4