2013-08-07 9 views
5

के लिए डब्ल्यूसीएफ कॉन्फ़िगर करना मेरे पास एक डब्ल्यूसीएफ सेवा है जो मूल एचटीपी बाइंडिंग का उपयोग करके काम करती है, मैं इसे https पर जाने और SQL सदस्यता प्रदाता के साथ प्रमाणित करने के लिए कॉन्फ़िगर करने की कोशिश कर रहा हूं, और ऐसा करने के लिए मैं इसे wsHttp बाइंडिंग का उपयोग करने के लिए परिवर्तित करने की कोशिश कर रहा हूं ।wsHttp बाइंडिंग

हालांकि, अद्यतन config के साथ मैं निम्नलिखित त्रुटि मिलती है जब मैं ग्राहक के साथ कनेक्ट करने का प्रयास:

डिफ़ॉल्ट endpoint तत्व नहीं मिल सका कि संदर्भ अनुबंध ServiceModel क्लाइंट कॉन्फ़िगरेशन अनुभाग में 'KFileService.IKFileWcfService' । ऐसा इसलिए हो सकता है क्योंकि आपके एप्लिकेशन के लिए कोई कॉन्फ़िगरेशन फ़ाइल नहीं मिली है, या क्योंकि इस अनुबंध से मेल खाने वाला कोई एंडपॉइंट तत्व क्लाइंट तत्व में नहीं पाया जा सकता है।

यहाँ सर्वर के लिए web.config के संबंधित भाग है:

<system.serviceModel> 
    <protocolMapping> 
     <remove scheme="http" /> 
     <add scheme="https" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IKFileWcfServiceBinding" /> 
    </protocolMapping> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="KFileWcfServiceBehavior"> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
      <serviceCredentials> 
      <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" 
       membershipProviderName="SqlMembershipProvider" /> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service behaviorConfiguration="KFileWcfServiceBehavior" name="KFileWcfService"> 
     <endpoint address="https://localhost:36492/KFileWcfService.svc" 
      binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IKFileWcfServiceBinding" 
      name="wsHttpBinding_IKFileWcfService" bindingName="wsHttpBinding_IKFileWcfServiceBinding" 
      contract="KFileWcfService.IKFileWcfService"> 
      <identity> 
      <certificateReference storeLocation="CurrentUser" /> 
      </identity> 
     </endpoint> 
     </service> 
    </services> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" multipleSiteBindingsEnabled="true"/> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpBinding_IKFileWcfServiceBinding" maxBufferPoolSize="2147483647" 
      maxReceivedMessageSize="2147483647"> 
      <readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="2147483647" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="Message"> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
</system.serviceModel> 

और यहाँ क्लाइंट पक्ष है:

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpBinding_IKFileWcfService" /> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://localhost:36492/KFileWcfService.svc" 
     binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IKFileWcfService" 
     contract="KFileWcfService.IKFileWcfService" name="wsHttpBinding_IKFileWcfService" /> 
    </client> 
    </system.serviceModel> 

मैं के माध्यम से जाना मेरे सबसे अच्छे किया है सब मौजूदा प्रश्न और उदाहरण पहले से ही हैं, लेकिन कोई भाग्य नहीं है। क्या कोई मुझे बता सकता है कि मैं क्या गलत कर रहा हूं?

संपादित करें:

<system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false before deployment --> 
      <serviceMetadata httpGetEnabled="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="true" /> 
      <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service name="KFileWcfService"> 
     <endpoint address="https://localhost:36492/KFileWcfService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IKFileWcfService" contract="KFileService.IKFileWcfService" name="BasicHttpBinding_IKFileWcfService" /> 
     </service> 
    </services> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" multipleSiteBindingsEnabled="true"/> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IKFileWcfService" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"> 
      <readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
</system.serviceModel> 

और ग्राहक:

आगे के संदर्भ के लिए, यहाँ सर्वर साइड कॉन्फ़िगरेशन कि basicHttpBinding के साथ काम करता है

<system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_IKFileWcfService" /> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="https://localhost:36492/KFileWcfService.svc" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IKFileWcfService" 
       contract="KFileService.IKFileWcfService" name="BasicHttpBinding_IKFileWcfService" /> 
     </client> 
    </system.serviceModel> 
+0

शायद आपके पुराने मूल एचटीपी बाइंडिंग को दिखाएं। –

+0

प्रश्न में जोड़ा गया। – Eric

उत्तर

6

ग्राहक पर सेवा अनुबंध के प्रकार जो आप अपने त्रुटि संदेश के आधार पर उपयोग करने का प्रयास कर रहे हैं:

KFileService.IKFileWcfService 

जो आप अपने ग्राहक config पर सेवा अनुबंध अंतरफलक के प्रकार:

KFileWcfService.IKFileWcfService 

वे एक ही होना चाहिए।

... contract="KFileService.IKFileWcfService" ... 

पर क्लाइंट कॉन्फ़िगरेशन बदलें और इसे काम करना चाहिए।

+2

अच्छा पुराना स्टैक ओवर प्रवाह। टाइपो के लिए कंधे समर्थन प्रदान करना। अच्छा पिकअप –

+0

हां, धन्यवाद! यह नहीं बताते कि मैं खुद को ध्यान में रखकर कितना समय देखता हूं। ऐसा लगता है कि कॉन्फ़िगरेशन के साथ अभी भी कुछ समस्याएं हैं, लेकिन इसने प्रश्न में उत्पन्न त्रुटि को हल किया है, इसलिए मैं इसे स्वीकृत उत्तर के रूप में चिह्नित कर रहा हूं। एक बार फिर धन्यवाद! – Eric

संबंधित मुद्दे