0

我看到网上有几个类似的主题,所以关于这个,但没有一个对我解决这个问题有帮助。

我有一个 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>

编辑:忘了提,如果我尝试从本地环境使用生产服务,它工作正常!

4

2 回答 2

2

Well, turned out to be a totally different issue. Turned out that the web application (and in effect the service) was in-accessible from the server itself, i.e. if I try to browse the site from the server itself, I would get a "Page not found" message.

于 2012-12-15T09:27:57.777 回答
0

我也有同样的问题。就我而言,我正在拨打电话的服务器存在防火墙问题。他们没有打开防火墙。打开后问题就解决了。

于 2015-10-14T20:15:03.407 回答