WCF服务错误元数据包含无法解析的引用

时间:2019-01-16 12:51:51

标签: c# wcf

我所有的WCF通信都开始遇到错误。当我尝试在Visual Studio中添加/连接到IIS部署的WCF服务时,出现此异常:

There was an error downloading 'http://localhost/f-service/ServiceHost/v1/BillService.svc?singleWsdl'.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Metadata contains a reference that cannot be resolved: 'http://localhost/f-service/ServiceHost/v1/BillService.svc?singleWsdl'.
Content Type application/soap+xml; charset=utf-8 was not supported by service
     

http://localhost/f-service/ServiceHost/v1/BillService.svc?singleWsdl。   客户端和服务绑定可能不匹配。       远程服务器返回错误:(415)由于内容类型为'application / soap + xml,因此无法处理该消息; charset = utf-8'   不是预期的类型'text / xml; charset = utf-8'。       如果服务是在当前解决方案中定义的,请尝试构建解决方案并再次添加服务引用。

WCF服务:

BillService.svc

<%@ ServiceHost Language="C#" Debug="true" Service="DA.Systems.F.ServiceHost.Internal.Implementation.v1.BillService" %>

Web.config

<?xml version="1.0" encoding="utf-8"?>

<configuration>

    <configSections>
        ...
    </configSections>

    <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    </appSettings>

    <system.web>
        <compilation debug="true" targetFramework="4.7.2" />
        <httpRuntime targetFramework="4.7.2" />
    </system.web>

    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="ServiceSoap" />
                <binding name="ServiceSoapTransport">
                    <security mode="Transport" />
                </binding>
            </basicHttpBinding>
        </bindings>

        <services>
            <service name="DA.Systems.Focus.ServiceHost.Internal.Implementation.v1.BillService">
                <endpoint address="" binding="basicHttpBinding" bindingNamespace="http://focus.dubaiairports.ae/services/internal/" bindingConfiguration="" contract="DA.Systems.Focus.Service.Contracts.Internal.v1.IBillService" />
                <host>
                    <timeouts closeTimeout="00:05:00" openTimeout="00:05:00" />
                </host>
            </service>
            <service name="DA.Systems.Focus.ServiceHost.Internal.Implementation.v1.CustomerService">
                <endpoint address="" binding="basicHttpBinding" bindingNamespace="http://focus.dubaiairports.ae/services/internal/" bindingConfiguration="" contract="DA.Systems.Focus.Service.Contracts.Internal.v1.ICustomerService" />
                <host>
                    <timeouts closeTimeout="00:05:00" openTimeout="00:05:00" />
                </host>
            </service>
        </services>

        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <protocolMapping>
            <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    </system.serviceModel>

</configuration>

该服务仅在几天前运行。现在,如果我访问该页面,则会得到基本页面(注意:另一个遭受saem问题的服务的屏幕截图):

Landing page

但是我对?wsdl?singleWsdl链接没有任何回应:

Error

我无法为该服务创建客户端。有人有任何想法吗?只有Windows 10 Insider Preview更新为最新版本,并且没有软件包更新。

更新

  • 我观察到:这是一个本地问题。如果将相同的源代码构建在不同的PC上,则可以正确运行/提供服务
  • 切换到IIS Express也可以

0 个答案:

没有答案