.net 流式WCF-400错误请求

.net 流式WCF-400错误请求,.net,wcf,streaming,http-status-code-400,.net,Wcf,Streaming,Http Status Code 400,在过去的几天里,我一直在建立一个流媒体服务,每次我回到任务中,我都会遇到同样的400个错误请求。我在网上搜索了很多帖子,这似乎是一个经常出现的问题,但每种情况都不同。下面是我的绑定设置的当前状态-我觉得这一定是我忽略的小问题 来自WCF探查器的信息: 调用服务时,将抛出一条警告,说明“未找到配置评估上下文” 下一项声明“未找到匹配的服务标记。已添加默认端点。” 这让我相信,无论我设置了什么,都没有应用到服务中,因此抛出错误请求错误,因为它使用的是我的流超过的~64kb默认值 &l

在过去的几天里,我一直在建立一个流媒体服务,每次我回到任务中,我都会遇到同样的400个错误请求。我在网上搜索了很多帖子,这似乎是一个经常出现的问题,但每种情况都不同。下面是我的绑定设置的当前状态-我觉得这一定是我忽略的小问题

来自WCF探查器的信息:

  • 调用服务时,将抛出一条警告,说明“未找到配置评估上下文”
  • 下一项声明“未找到匹配的服务标记。已添加默认端点。”
这让我相信,无论我设置了什么,都没有应用到服务中,因此抛出错误请求错误,因为它使用的是我的流超过的~64kb默认值

      <!-- Services Config -->
        <system.web>
        <httpRuntime maxRequestLength="2097150" executionTimeout="7200"/>
        <compilation debug="true" targetFramework="4.0" />    
        </system.web>
    <system.serviceModel>
    <bindings>
      <basicHttpBinding>        
          <binding name="StreamingService"  maxReceivedMessageSize="2147483647"  maxBufferSize="2147483647" transferMode="Streamed" >
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
            <security mode="None">
            </security>
          </binding>        
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="StreamingService" behaviorConfiguration="StreamingServiceBehavior">
          <endpoint address="http://localhost:50577/StreamingContent.svc"
         binding="basicHttpBinding" bindingConfiguration="StreamingService"
         contract="IStreamingContent" name="BasicHttpBinding_IStreamingContent" />
      </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

       <!-- Web Server Config -->
        <bindings>
        <basicHttpBinding>
  <binding name="BasicHttpBinding_IStreamingContent" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647"
           maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
    </basicHttpBinding>
    </bindings>    
    <client>
        <endpoint address="http://localhost:50577/StreamingService.svc"
             binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IStreamingService"
            contract="StreamingService.IStreamingService" name="BasicHttpBinding_IStreamingService" />
        </client>

任何新的观点肯定会有所帮助

编辑:我在接受下面的建议后更新了上面的配置,但在探查器中仍然发现相同的问题,没有找到匹配的标记,只是这次我相信我的设置是正确的。。。。。显然不是因为它现在能起作用,不是吗


想法?

我认为您出现问题的原因之一是您使用服务器端的
部分配置端点,而实际上您应该使用
部分来配置您的服务端点。请在此处查看流的服务器配置文件示例

对配置文件要特别小心,这是未来读者在WCF中遇到的大多数问题

我得到“找不到匹配的标记。添加了默认端点。”

我的xml很好。(在我花了一个小时试图找到格式错误的xml之后)

对我来说,问题是我已经更改了我的具体服务类的名称空间

关键是这个

在.svc文件中,有一些标记

<%@ ServiceHost Language="C#" Debug="true" Service="MyCompany.MyNamespace.MyConcreteService" %>
确保您具有正确的完全限定名,并将它们正确复制到.svc文件和xml文件中

我从这里得到了答案:


WCF可能无法识别该元素。元素中“name”属性的值必须是服务类的完全限定名-因为您使用IIS托管服务,所以它必须与.svc文件中@ServiceHost标记中的“service”属性的值相同。

叹气-是的,我想这让我朝着正确的方向前进了。在客户端设置它对我来说似乎是错误的。我会让你知道的。提前谢谢。虽然我觉得这会使船恢复正常,但还是有些问题。
  <service name="MyCompany.MyNamespace.MyConcreteService"
           behaviorConfiguration="MyServiceBehavior"
           >

        <!-- 
        Whole bunch of other stuff not shown here
        -->

  </service>
namespace MyCompany.MyNamespace
{
    public class MyConcreteService : IMyService
    {
    }
}