Rest – HTTP Error 500.19 – Internal Server Error The requested page cannot (WCF + REST + IIS7 + SSL)

httpsiis-7restsslwcf

I am having a "dandy" time trying to get my WCF REST service hosted on IIS with SSL.

Environment: I am testing on a Windows7 box with a local IIS server. I have self-registered a certificate on my dev box and have:

  1. Created a site in IIS for the purposes of exposing this WCF service via HTTPS.
  2. Created an application under this site and named it "api"
  3. Navigated to my site in IIS
  4. Clicked 'Bindings…' in the Actions panel on the right.
  5. Clicked 'Add'
  6. Selected 'https' and selected my certificate.

A lot of the REST plumbing is handled via extensions in WCF using the WcfRestContrib library. While this has been useful from a programming point of view, there is little out there in the way of documentation when something goes wrong.

The error I am currently getting is:

Error Summary

HTTP Error 500.19 - Internal Server Error The requested page cannot

be accessed because the related
configuration data for the page is
invalid. Detailed Error Information
Module IIS Web Core
Notification BeginRequest Handler Not
yet determined Error Code 0x8007000d
Config Error Config
File \?\C:\inetpub\eMobile\api\web.config
Requested
URL https://172.xx.xx.254:443/api
Physical
Path C:\inetpub\eMobile\api Logon
Method Not yet determined Logon
User Not yet determined

Config Source

   -1: 
    0:

I am really not surew what I am doing wrong here. So far I have tried resenting feature delegation for my site but that didn't work. Any ideas? Anything look odd in my web.config?

Thanks.

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="e1ConnectionString" connectionString="Data Source=USSV112;Initial Catalog=e1;Integrated Security=True"
      providerName="System.Data.SqlClient" />
    <add name="e2ConnectionString" connectionString="Data Source=USSV112;Initial Catalog=e2;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  <system.web>
    <httpRuntime maxRequestLength="204800" executionTimeout="3600"/>
    <compilation debug="true" targetFramework="4.0">
    </compilation>
    <httpModules>
      <add name="ServiceAnonymityModule" type="WcfRestContrib.Web.ServiceAnonymityModule, WcfRestContrib, Version=1.0.6.107, Culture=neutral"/>
    </httpModules>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Users" stopProcessing="true">
          <match url="^rest/users/(.*)$"/>
          <action type="Rewrite" url="rest/Users.svc/{R:1}" />
        </rule>
      </rules>
    </rewrite>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <remove name="ServiceAnonymityModule"/>
      <add name="ServiceAnonymityModule" type="WcfRestContrib.Web.ServiceAnonymityModule, WcfRestContrib, Version=1.0.6.107, Culture=neutral"/>
    </modules>
  </system.webServer>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
        <listeners>
          <add name="messages" type="System.Diagnostics.XmlWriterTraceListener" initializeData="d:\Temp\WcfRestContribErrors.log" />
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
          <add name="messages" type="System.Diagnostics.XmlWriterTraceListener" initializeData="d:\Temp\WcfRestContribMessages.log" />
        </listeners>
      </source>
    </sources>
    <trace autoflush="true"/>
  </system.diagnostics>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <extensions>
      <behaviorExtensions>
        <add name="webAuthentication" type="WcfRestContrib.ServiceModel.Configuration.WebAuthentication.ConfigurationBehaviorElement, WcfRestContrib, Version=1.0.6.107, Culture=neutral, PublicKeyToken=89183999a8dc93b5" />
        <add name="errorHandler" type="WcfRestContrib.ServiceModel.Configuration.ErrorHandler.BehaviorElement, WcfRestContrib, Version=1.0.6.107, Culture=neutral, PublicKeyToken=89183999a8dc93b5" />
        <add name="webFormatter" type="WcfRestContrib.ServiceModel.Configuration.WebDispatchFormatter.ConfigurationBehaviorElement, WcfRestContrib, Version=1.0.6.107, Culture=neutral, PublicKeyToken=89183999a8dc93b5" />
        <add name="webErrorHandler" type="WcfRestContrib.ServiceModel.Configuration.WebErrorHandler.ConfigurationBehaviorElement, WcfRestContrib, Version=1.0.6.107, Culture=neutral, PublicKeyToken=89183999a8dc93b5" />
      </behaviorExtensions>
    </extensions>
    <bindings>
      <customBinding>
        <binding name="HttpStreamedRest">
          <httpTransport maxReceivedMessageSize="209715200" manualAddressing="true"/>
        </binding>
        <binding name="HttpsStreamedRest">
          <httpsTransport maxReceivedMessageSize="209715200"  manualAddressing="true"/>
        </binding>
      </customBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Rest">
          <webAuthentication authenticationHandlerType="WcfRestContrib.ServiceModel.Dispatcher.WebBasicAuthenticationHandler, WcfRestContrib"
            usernamePasswordValidatorType="Engage.Mobile.WebServices.Runtime.SecurityValidator, Engage.Mobile.WebServices"
            requireSecureTransport="false" source="E Mobile" />
          <webFormatter>
            <formatters defaultMimeType="application/json">
              <formatter type="WcfRestContrib.ServiceModel.Dispatcher.Formatters.PoxDataContract, WcfRestContrib"
                mimeTypes="application/xml,text/xml" />
              <formatter type="WcfRestContrib.ServiceModel.Dispatcher.Formatters.DataContractJson, WcfRestContrib"
                mimeTypes="application/json" />
              <formatter type="WcfRestContrib.ServiceModel.Dispatcher.Formatters.FormUrlEncoded, WcfRestContrib"
                mimeTypes="application/x-www-form-urlencoded" />
            </formatters>
          </webFormatter>
          <errorHandler errorHandlerType="WcfRestContrib.ServiceModel.Web.WebErrorHandler, WcfRestContrib" />
          <webErrorHandler logHandlerType="Engage.Mobile.WebServices.Runtime.LogHandler, Engage.Mobile.WebServices" returnRawException="true" exceptionDataContractType="" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

Best Answer

It looks very much like this thread

The proposed answer was

  1. Right click the folder where your site is located: "C:\Users\NAME\SiteName" and selecting Properties
  2. Select the Security tab and click on Edit
  3. Add.. and type in "IIS_IUSRS"
Related Topic