我看到网上有几个类似的主题,所以关于这个,但没有一个对我解决这个问题有帮助。
我有一个 wcf 服务,它由 IIS 中的同一个 Web 应用程序(不要问为什么)托管和使用。所以我的 web.config 看起来像这样
<system.serviceModel>
<services>
<service name="Management.Service.ManagementService" behaviorConfiguration="Management.Service.ManagementServiceBehavior">
<endpoint name="default" binding="basicHttpBinding" bindingConfiguration="default" contract="Management.Service.IManagementService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Management.Service.ManagementServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<bindings>
<basicHttpBinding>
<binding name="default" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="true" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="false">
<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>
<client>
<endpoint address="http://www.example.com/Service.svc"
binding="basicHttpBinding" bindingConfiguration="default"
contract="Management.Client.IManagementService" name="default" />
</client>
</system.serviceModel>
这在我的本地环境中工作得非常好,我什至可以在任何浏览器中浏览到服务(生产)。但是由于某种原因,我There was no endpoint listening
在生产服务器上收到错误。
我还尝试在标记后添加以下块<system.serviceModel>
以启用跟踪,但我没有看到正在生成任何跟踪文件。
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true" >
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\inetpub\WcfClient.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="xml"/>
</sharedListeners>
</system.diagnostics>
编辑:忘了提,如果我尝试从本地环境使用生产服务,它工作正常!