[英]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.