我在运行wcf时遇到错误

时间:2014-07-04 09:27:07

标签: c# asp.net wcf iis

我在本地IIS上托管了服务

当我在浏览器上测试服务时,我不知道为什么会出现此错误 当我从visual studio运行时,服务工作正常,但是当我在IIS上托管它时,它工作不正常

我是第一次这样做。当我从visual studio运行时,服务工作正常,但是当我在IIS上托管它时它无法正常工作

以下是错误页面的截图。

enter image description here

1 个答案:

答案 0 :(得分:0)

在服务模型中设置以下内容  

<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
<services>
  <service name="SyncWebServices.Service1" behaviorConfiguration="">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basichttp" contract="SyncWebServices.Service1">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name="basichttp" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:25:00" sendTimeout="00:25:00" maxReceivedMessageSize="4294967296" transferMode="Streamed">
   <readerQuotas maxDepth="4500000" maxStringContentLength="4500000" maxBytesPerRead="40960000" maxNameTableCharCount="250000000" maxArrayLength="4500000" />
      <security mode="None">
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true" />
      <serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<standardEndpoints>
  <webHttpEndpoint>
    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
  </webHttpEndpoint>
</standardEndpoints>