Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf 一个ServiceHost,两个端点(net.tcp和基本http)_Wcf_C# 4.0_Wcf Binding - Fatal编程技术网

Wcf 一个ServiceHost,两个端点(net.tcp和基本http)

Wcf 一个ServiceHost,两个端点(net.tcp和基本http),wcf,c#-4.0,wcf-binding,Wcf,C# 4.0,Wcf Binding,我有工作要做;我们正在尝试添加对Mac的支持,因此正在添加BasicHttpBinding。最终,我希望使用相同的ServiceHost来完成这项工作,但当我尝试浏览到(test是一个OperationContract,我设计它只是为了输出一些文本)时,它会以“400错误请求”响应。我缺少什么 这是作为Windows服务托管的。下面是App.config安装程序的外观: <service name="Wcf.Lss" behaviorConfiguration="DefaultBeha

我有工作要做;我们正在尝试添加对Mac的支持,因此正在添加BasicHttpBinding。最终,我希望使用相同的ServiceHost来完成这项工作,但当我尝试浏览到(test是一个OperationContract,我设计它只是为了输出一些文本)时,它会以“400错误请求”响应。我缺少什么

这是作为Windows服务托管的。下面是App.config安装程序的外观:

  <service name="Wcf.Lss" behaviorConfiguration="DefaultBehavior">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBinding" contract="Wcf.ILss"/>
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="" contract="Wcf.ILss" />
  </service>
</services>
<bindings>
  <netTcpBinding>
    <binding name="netTcpBinding" maxReceivedMessageSize="9655360" maxBufferSize="9655360" maxBufferPoolSize="524288">
      <readerQuotas maxArrayLength = "932000" maxStringContentLength="900000" maxDepth="32"/>
      <security mode="None"></security>
    </binding>
  </netTcpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="DefaultBehavior" >
      <serviceDebug includeExceptionDetailInFaults="True"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

您不能浏览到操作,只能浏览到在您的情况下托管在基址上的服务。所以,当你浏览到“http://localhost:8085/Lss“您应该看到标准WCF测试页面

var baseTcpUri = new Uri("net.tcp://localhost:8080/Lss");
var baseHttpUri = new Uri("http://localhost:8085/Lss");
var host = new ServiceHost(wcfSingleton, baseTcpUri, baseHttpUri);

host.Description.Behaviors.Add(new ServiceMetadataBehavior() { HttpGetEnabled = true, HttpGetUrl=baseHttpUri });

var throttlingBehavior = new System.ServiceModel.Description.ServiceThrottlingBehavior();
throttlingBehavior.MaxConcurrentCalls = 50;
throttlingBehavior.MaxConcurrentInstances = 10;
throttlingBehavior.MaxConcurrentSessions = 10;
host.Description.Behaviors.Add(throttlingBehavior);

host.Open();