[英]Why Creating new session id every time in wsHttpBinding
我正在使用以下配置使我的服務成為會話性,但是對於每個請求,wcf服務都以新的會話ID響應我。 為什么要這樣,我需要使該客戶端具有會話性,以便每個請求都應具有相同的會話ID
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttp">
<readerQuotas maxStringContentLength="10240" />
<reliableSession enabled="true" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="wcfservice.serviceclass" behaviorConfiguration="MyFileServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:51/"/>
<add baseAddress="net.tcp://localhost:52/"/>
</baseAddresses>
</host>
<endpoint address="pqr" binding="wsHttpBinding" bindingConfiguration="wsHttp"
name="b" contract="wcfservice.Iservice" />
<endpoint address="pqr" binding="netTcpBinding"
name="c" contract="wcfservice.Iservice" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyFileServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
默認情況下,打開頻道時會啟動一個會話,您可以在WCF的此會話中閱讀有關此內容的更多信息。
由於IsInitiating參數的默認值為true,因此您的每個調用都啟動了一個新會話。 在此處閱讀有關它的更多信息IsInitiating和IsInitiating
因此,在您的運營合同中
[OperationContract(
IsInitiating=false,
IsTerminating=false
)]
public void MethodOne()
{
return;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.