Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/302.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
C# 即使I';我正在使用wsHttpBinding_C#_.net_Wcf - Fatal编程技术网

C# 即使I';我正在使用wsHttpBinding

C# 即使I';我正在使用wsHttpBinding,c#,.net,wcf,C#,.net,Wcf,我正在尝试在wsHttpBinding端点公开WCF服务,它会给我以下错误消息: 契约需要会话,但具有约束力 “BasicHttpBinding”不支持它 或者未正确配置为 支持它 以下是界面: [ServiceContract(Namespace="http://server.com/orderservices/",SessionMode=SessionMode.Required)] public interface IOrderService { [OperationContract

我正在尝试在wsHttpBinding端点公开WCF服务,它会给我以下错误消息:

契约需要会话,但具有约束力 “BasicHttpBinding”不支持它 或者未正确配置为 支持它

以下是界面:

[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);
}
这是我的web.config文件(该服务托管在IIS 7中):


如果您发布了您的服务界面,我可以肯定地说,但我相信您的服务界面上有这样的内容:

 [ServiceContract(SessionMode = SessionMode.Required)]

这需要会话,
BasicHttpBinding
不支持它。如果需要会话,则需要使用wsHttpBinding。

Hmmm。。。。检查您的服务合同-这是一个
IOrderService

[ServiceContract(Namespace="http://server.com/orderservices/",SessionMode=SessionMode.Required)]
public interface IOrderService
{
}
但是在您的配置中,您正在为
eMidWare.IPricingDataService

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


因此,我相信,.NET/WCF 4将引入默认端点,
http://
scheme的默认端点是
basicHttpBinding

问题是我在配置文件中使用的是wsHttpBinding,而不是basicHttpBinding。您可以在上面发布的my web.config中看到它。svc文件位于c:\inetpub中directory@marc_s,我甚至无法使用指向.svc文件的浏览器在本地访问该服务。请检查我的答案-我认为您的配置和服务合同文件不匹配…您的示例显示了IOrderService合同,您的配置使用IPricingDataService合同。IOrderService在哪里使用?@Ladislav,谢谢。我刚刚纠正了那个错误,但我还是收到了同样的错误信息。谢谢,马克。我相信,你是对的,WCF4引入了一个默认端点。
<endpoint 
    address="" 
    binding="wsHttpBinding" bindingConfiguration="longTimeoutBinding"
    contract="eMidWare.IPricingDataService">