简体   繁体   English

获取与basicHttpBinding相关的错误消息,即使我正在使用wsHttpBinding

[英]getting error message related to basicHttpBinding even though I'm using wsHttpBinding

I am trying to expose a WCF service at a wsHttpBinding endpoint and it gives me the following error message : 我试图在wsHttpBinding端点公开WCF服务,它给我以下错误消息:

Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it. 合同需要Session,但Binding'BasicHttpBinding'不支持它,或者没有正确配置以支持它。

Here is the interface : 这是界面:

[ServiceContract(Namespace="http://server.com/orderservices/",SessionMode=SessionMode.Required)]
public interface IOrderService
{
    [OperationContract(IsInitiating=true,IsTerminating=false)]
    string GetOrderNumber();

    [OperationContract(IsInitiating = false, IsTerminating = true)]
    void CreateOrder(string orderXML);
}

Here is my web.config file (the service is hosted in IIS 7 ) : 这是我的web.config文件(该服务托管在IIS 7中):

<system.serviceModel>
   <bindings>
      <wsHttpBinding>
         <binding name="longTimeoutBinding" 
             receiveTimeout="00:10:00" sendTimeout="00:10:00">
         </binding>
      </wsHttpBinding>
   </bindings>
   <services>
      <service name="eMidWare.OrderService">
         <host>
            <baseAddresses>
                <add baseAddress = "http://localhost/" />
            </baseAddresses>
         </host>
         <!-- Service Endpoints -->
         <endpoint 
            address="" 
            binding="wsHttpBinding" bindingConfiguration="longTimeoutBinding"
            contract="eMidWare.IPricingDataService">
         </endpoint>
         <endpoint 
             address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
   </services>
   <behaviors>
      <serviceBehaviors>
         <behavior>
            <serviceDebug includeExceptionDetailInFaults="True" />
         </behavior>
      </serviceBehaviors>
   </behaviors>
</system.serviceModel>

Hmmm.... check your service contract - it's a IOrderService 嗯....检查你的服务合同 - 这是一个IOrderService

[ServiceContract(Namespace="http://server.com/orderservices/",SessionMode=SessionMode.Required)]
public interface IOrderService
{
}

but in your config, you're setting up an endpoint for eMidWare.IPricingDataService 但在您的配置中,您正在为eMidWare.IPricingDataService设置端点

<endpoint 
    address="" 
    binding="wsHttpBinding" bindingConfiguration="longTimeoutBinding"
    contract="eMidWare.IPricingDataService">

Therefore, I believe, .NET / WCF 4 will kick in a default endpoint, which is of basicHttpBinding for the http:// scheme by default.... 因此,我相信,.NET / WCF 4将启动默认端点,默认情况下为http://方案的basicHttpBinding ....

If you had posted your service interface I could have said with certainty but I believe you have something like this on your service interface: 如果您已经发布了您的服务界面,我可以肯定地说,但我相信您的服务界面上有这样的东西:

 [ServiceContract(SessionMode = SessionMode.Required)]

This would require session and BasicHttpBinding does not support it. 这将需要会话,而BasicHttpBinding不支持它。 You need to use wsHttpBinding if you need to have sessions. 如果需要进行会话,则需要使用wsHttpBinding。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使我有匹配的大括号,我也会收到“} Expected”错误 - I'm getting "} Expected" Error even though I have matching braces 即使我正在修改不同的集合,也会收到“Collection was modified”错误 - Getting “Collection was modified ” error even though I'm modifying a different collection BasicHttpBinding和WsHttpBinding之间的代理 - Proxy between BasicHttpBinding and WsHttpBinding 是否应该使用basicHttpBinding或WsHttpBinding创建安全的Java客户端? - Should I use basicHttpBinding or WsHttpBinding for creating a secure Java Client? 即使我在模型和数据库中都定义了一个键,我还是收到了错误“EntityType 没有定义键” - I'm getting the error 'EntityType has no key defined' even though I've defined a key in both the model and the database GetFileLineNumber()返回0,即使我正在使用调试版本 - GetFileLineNumber() returns 0, even though I'm using a debug build ObjectDisposedException,即使我正在使用.Include(),. ToList()和其他所有内容 - ObjectDisposedException even though I'm using .Include(), .ToList(), and everything else 即使我使用完全限定的名称,也收到了模棱两可的引用错误 - I am getting an ambiguous reference error even though I am using fully qualified name 为什么我在与声明相同的作用域中使用“为什么名称在当前上下文中不存在”错误 - Why do I get the “name does not exist in current context” error even though I'm using name in the same scope as its declaration 为什么即使我明确将纸张数设置为1,我也会得到一张多余的纸张? - Why am I getting a superfluous sheet even though I'm explicitly setting sheet count to 1?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM