InvalidOperationException:客户端发现响应内容类型为“”,但预期为“ text / xml”请求失败,响应为空

问题描述

我刚刚创建了一个处理WCF服务的Web应用程序。现在在linqpad5中,我只是从此类加载所有方法。并仅写入是否测试从此服务接收的输出

这是我的电脑的屏幕截图:

enter image description here

但是在执行小程序时,我只是遇到了这样的错误

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>

这里出了什么问题...请帮帮我这些人...

更新

此服务可用于iis浏览:

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)