में एसएसएल wsHttp बाइंडिंग के साथ सत्र को कैसे सक्षम करें मेरे पास wsHttp बाइंडिंग और एसएसएल सक्षम के साथ एक डब्ल्यूसीएफ सेवा है, लेकिन मैं डब्ल्यूसीएफ सत्र सक्षम करना चाहता हूं।डब्ल्यूसीएफ
आवश्यक
SessionMode:=SessionMode.Required
को SessionMode बदलने के बाद मैं त्रुटि नीचे वर्णित हो रही है।
अनुबंध सत्र की आवश्यकता है, लेकिन बाध्यकारी 'WSHttp बाइंडिंग' का समर्थन नहीं करता है या इसे समर्थन देने के लिए ठीक से कॉन्फ़िगर नहीं किया गया है।
यहां मेरा नमूना आवेदन है।
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<client />
<bindings>
<wsHttpBinding>
<binding name="NewBinding0" useDefaultWebProxy="false" allowCookies="true">
<readerQuotas maxStringContentLength="10240" />
<!--reliableSession enabled="true" /-->
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" >
<extendedProtectionPolicy policyEnforcement="Never" />
</transport >
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WcfServiceLib.TestService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NewBinding0"
contract="WcfServiceLib.ITestService">
<identity>
<servicePrincipalName value="Local Network" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://test/TestService.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
ITestService.vb
<ServiceContract(SessionMode:=SessionMode.Required)>
Public Interface ITestService
<OperationContract(IsInitiating:=True, IsTerminating:=False)> _
Function GetData(ByVal value As Integer) As String
End Interface
TestService.vb
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession, _
ReleaseServiceInstanceOnTransactionComplete:=False, _
ConcurrencyMode:=ConcurrencyMode.Single)>
Public Class TestService
Implements ITestService
Private _user As User
<OperationBehavior(TransactionScopeRequired:=True)>
Public Function GetData(ByVal value As Integer) As String _
Implements ITestService.GetData
If _user Is Nothing Then
_user = New User()
_user.userName = "User_" & value
_user.userPassword = "Pass_" & value
Return String.Format("You've entered: {0} , Username = {1} , Password = {2} ", _
value, _user.userName, _user.userPassword)
Else
Return String.Format("Username = {1} , Password = {2} ", _
_user.userName, _user.userPassword)
End If
End Function
End Class
मैं सभी पो की कोशिश की ssible समाधान, मैं पा सकता था, लेकिन कुछ भी मदद की।
विश्वसनीय सत्र सक्षम करने के लिए कुछ सलाह है, लेकिन यह ssl साथ काम नहीं करता है (यदि केवल आप अपने कस्टम बाध्यकारी है), दूसरों को सलाह http बजाय https उपयोग करने के लिए है, लेकिन मैं था मेरे मौजूदा कॉन्फ़िगरेशन के साथ सत्र सक्षम करने की तरह, यदि यह संभव है।
क्या यह प्राप्त करने के लिए कोई दृष्टिकोण है?
किसी भी प्रकार की सहायता की बहुत सराहना की जाती है।
डब्ल्यूसीएफ सेवा पर सत्र स्थिति को सक्षम करने का क्या कारण है? यदि आप उच्च प्रदर्शन की तलाश में हैं तो यह एक बाधा हो सकती है। सत्र राज्य डब्ल्यूसीएफ सेवा से बचा जाना चाहिए। –
मैं प्रत्येक सत्र के लिए _user चर होना चाहता हूं। मुझे प्रत्येक कॉल के लिए सेवा कक्षा का एक नया उदाहरण मिलता है। _user का मूल्य हमेशा कुछ भी नहीं है। – hgulyan
यदि मुझे प्रत्येक ग्राहक के लिए डेटा स्टोर करने की आवश्यकता है, तो मुझे अपनी स्थिति के लिए किस समाधान का उपयोग करना चाहिए? – hgulyan