在IIS上托管WCF(Windows Communication Foundation)通常需要一些特殊设置。以下是一些关键步骤,以确保IIS上的WCF服务正常运行:
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_ConfigurationName" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<service name="YourServiceName">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_ConfigurationName" contract="YourServiceContract" />
</service>
</services>
完成以上步骤后,您的WCF服务应该可以在IIS上正常运行。如果遇到任何问题,请检查服务器的事件日志以获取更多信息。
领取专属 10元无门槛券
手把手带您无忧上云