Wcf InvalidOperationException:客户端发现响应内容类型为'';,但预期';text/xml';。请求失败,响应为空
我刚刚创建了一个处理WCF服务的web应用程序。现在在linqpad5中,我只加载这个类中的所有方法。并只写测试是否从该服务接收到输出 这是我电脑的屏幕截图: 但在执行小程序时,我得到了如下错误:Wcf InvalidOperationException:客户端发现响应内容类型为'';,但预期';text/xml';。请求失败,响应为空,wcf,c#-4.0,asp.net-4.0,Wcf,C# 4.0,Asp.net 4.0,我刚刚创建了一个处理WCF服务的web应用程序。现在在linqpad5中,我只加载这个类中的所有方法。并只写测试是否从该服务接收到输出 这是我电脑的屏幕截图: 但在执行小程序时,我得到了如下错误: InvalidOperationException: Client found response content type of '', but expected 'text/xml'. The request failed with an empty response. 有关更多信息,我只提供
InvalidOperationException: Client found response content type of '', but expected 'text/xml'.
The request failed with an empty response.
有关更多信息,我只提供托管wcf服务配置:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" defaultLanguage="c#" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="LargeWeb" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="RestServiceImplClient">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeWeb" contract="IRestServiceImpl" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebHttp">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
<staticContent>
<mimeMap fileExtension=".svc" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
我检查了您的配置文件,没有发现任何问题。我怀疑这可能是WCF服务的问题。你的服务能正常运行吗?是的,在使用iis浏览时,它的工作方式很有魅力。请参阅更新部分。我认为这可能不是WCF服务的问题,但可能与linqpad5有关。你能用c#呼叫WCF服务吗?