Error in Protocol Mapping While hosting a WCF service in IIS

52,585

Solution 1

Amr,

This sounds like you may have permission issues in the folder you .svc is running from, please can you check and see if the following permissions are there:

  • \IIS_IUSERS
  • \IIS_IUSR ---If running webservice in Anonymous Mode

For the issue with protocol Mapping, please ensure that the app Pool you are using for the IIS site is setup to use .net 4, as from what I understand protocol mapping is only available in .net 4.

Hope this helps

Solution 2

I had the same issue, but finally figured out that you have to set the DEFAULT application pool to .Net 4.0, not just the Application Pool for the individual website.

Solution 3

For the issue with protocol Mapping, please ensure that the app Pool you are using for the IIS site is setup to use .net 4.

enter image description here

Solution 4

I have face the same issue. By changing application pool .net framework from 2.0 to 4.o was solved my problem

Share:
52,585
Amr Ramadan
Author by

Amr Ramadan

Updated on July 09, 2022

Comments

  • Amr Ramadan
    Amr Ramadan almost 2 years

    I developed a simple WCF service with VS 2010. And i hosted in the default website in IIS by Adding Application and set the Physical Path

    And i tried to browse the .svc file it gives me the following error:

    "The configuration section 'protocolMapping' cannot be read because it is missing a section declaration"

    Protocol Mapping Error

    and I tried many solutions but it doesn't work

    I Created WCF Service Library has an App.config with this:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" />
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's 
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <services>
          <service name="EvalServiceLibrary.EvalService">
            <clear />
            <endpoint address="basic" binding="basicHttpBinding" contract="EvalServiceLibrary.IEvalService"
              listenUriMode="Explicit">
              <identity>
                <dns value="localhost" />
                <certificateReference storeName="My" storeLocation="LocalMachine"
                  x509FindType="FindBySubjectDistinguishedName" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
              listenUriMode="Explicit">
              <identity>
                <dns value="localhost" />
                <certificateReference storeName="My" storeLocation="LocalMachine"
                  x509FindType="FindBySubjectDistinguishedName" />
              </identity>
            </endpoint>
            <endpoint address="ws" binding="wsHttpBinding" contract="EvalServiceLibrary.IEvalService"
              listenUriMode="Explicit">
              <identity>
                <dns value="localhost" />
                <certificateReference storeName="My" storeLocation="LocalMachine"
                  x509FindType="FindBySubjectDistinguishedName" />
              </identity>
            </endpoint>
            <endpoint address="net.tcp://localhost:8888/evalservice" binding="netTcpBinding"
              contract="EvalServiceLibrary.IEvalService" listenUriMode="Explicit">
              <identity>
                <dns value="localhost" />
                <certificateReference storeName="My" storeLocation="LocalMachine"
                  x509FindType="FindBySubjectDistinguishedName" />
              </identity>
            </endpoint>
            <endpoint address="net.pipe://localhost/evalservice" binding="netNamedPipeBinding"
              bindingConfiguration="" contract="EvalServiceLibrary.IEvalService" />
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8080/evalservice" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, 
              set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
              <!-- To receive exception details in faults for debugging purposes, 
              set the value below to true.  Set to false before deployment 
              to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>
    

    and i Hosted the WCF Service Library application in WCF website (My Client) has an Web.config with this:

    <?xml version="1.0"?>
    <configuration>
    
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="false" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/>
      </system.web>
      <system.serviceModel>
        <services>
          <service name="EvalServiceLibrary.EvalService">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="" contract="EvalServiceLibrary.IEvalService" />
            <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
            <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="" contract="EvalServiceLibrary.IEvalService" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <protocolMapping>
          <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <directoryBrowse enabled="true"/>
      </system.webServer>
    </configuration>
    
  • Amr Ramadan
    Amr Ramadan over 11 years
    permission issue solved. but now i'm trying to solve Protocol Mapping error
  • David
    David over 10 years
    For me, adding the extra permissions was not necessary--just fixing the app pool as you directed was enough to fix the problem. Thanks.
  • Kiquenet
    Kiquenet about 8 years
    @AmrRamadan any final solution about Protocol Mapping error ?