在IIS 8.5上部署WCF

时间:2014-06-30 15:29:29

标签: wcf windows-8.1 web-config iis-8.5

我正在尝试在IIS 8.5上部署IIS服务应用程序,但每次尝试通过http://localhost/test/WCFService.svc连接到服务时,我都会看到以下屏幕:

enter image description here

当我转到turn Windows features On or OFF时,我有以下内容:

enter image description here

我的web.config看起来如下:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name ="MessageServaceBehavior">
          <!-- 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>
    <services>

      <service name ="WCF_Connection.WCFService" behaviorConfiguration="MessageServaceBehavior">

        <host>
          <baseAddresses>
            <add baseAddress="http://10.0.5.32:58632/WCF_Service/"/>
          </baseAddresses>
        </host>
        <endpoint name ="getMessage" address="" binding="basicHttpBinding" contract="WCF_Connection.IWCFService"/>
         <!--<endpoint name ="MessgaeServiceMex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->        

      </service>
    </services>

   <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>

导致此问题的原因以及如何解决此问题?

1 个答案:

答案 0 :(得分:11)

您可能缺少WCF HTTP激活功能。它位于Windows功能屏幕的不同部分(请查看下面的屏幕),据我所知,安装IIS时默认情况下不启用它。

enter image description here