【问题标题】:It throws EndpointNotFoundException even though it is an Endpoint即使它是一个端点,它也会抛出 EndpointNotFoundException
【发布时间】:2022-01-22 04:41:27
【问题描述】:

为了获取报告,我们将数据从我们的主项目发送到报告服务。 主项目是用.net 3.1开发的。服务类型:WCF。要使用该服务,我们将其作为服务引用添加到项目中。我们可以使用服务的子方法如下。

WebService1SoapClient service = new WebService1SoapClient(WebService1SoapClient.EndpointConfiguration.WebService1);

var serviceOutput = await service.ReportsAsync(modelService);

当我在本地运行程序并想要得到报告时,我可以得到一个没有任何错误的报告。但是当我尝试在服务器端运行它时,出现以下错误。你能帮帮我吗?

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://xxx.xxx.com/WebService1.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

web.config 文件中的端点

<system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="ReportServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <bindings>
            <basicHttpBinding>
                <binding name="ReportServiceBinding" maxReceivedMessageSize="4194304" transferMode="Streamed">
                    <readerQuotas maxArrayLength="4194304" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <services>
            <service behaviorConfiguration="ReportServiceBehavior" name="[ProjectName].ReportPages.ReportService1">
                <endpoint address="" binding="basicHttpBinding" bindingConfiguration="ReportServiceBinding" contract="DevExpress.XtraReports.Service.IReportService" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            </service>
        </services>
    </system.serviceModel>

【问题讨论】:

    标签: asp.net-core wcf endpoint


    【解决方案1】:

    您可以尝试以下步骤:
    1.可以在配置中定义端点地址。

    <services>
      <service behaviorConfiguration="ReportServiceBehavior" name="[ProjectName].ReportPages.ReportService1">
         <endpoint address="http://xxx.xxx.com/WebService1.asmx" binding="basicHttpBinding" bindingConfiguration="ReportServiceBinding" contract="DevExpress.XtraReports.Service.IReportService" />
         <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    

    2.我建议你检查一下服务器上是否有应用程序正在监听该端口,并且没有其他程序正在监听该端口,并且你没有设置任何防火墙规则来阻止该服务端口。
    3.尝试通过在配置中将此参数设置为true来启用显示失败。 &lt;serviceDebug includeExceptionDetailInFaults = "True" /&gt;。希望这将提供更详细的信息。

    【讨论】:

    猜你喜欢
    • 2014-06-13
    • 2022-06-15
    • 1970-01-01
    • 2023-03-07
    • 1970-01-01
    • 1970-01-01
    • 2015-09-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多