2012-07-14 22 views
11

समस्या:एक्स.50 9 प्रमाण पत्र?

मैं इस कार्यक्रम को एक मशीन पर विकसित कर रहा हूं।

सेवा विकास सर्वर में ठीक काम करता है, लेकिन जब मैं आईआईएस में सेवा की मेजबानी करने की कोशिश यह मुझे एक त्रुटि देता है:

X.509 प्रमाणपत्र निम्न खोज मानदंडों का उपयोग नहीं मिली: StoreName ' मेरा ', स्टोर स्थान' CurrentUser ', FindType' FindBySubjectName ', FindValue' WCFServer '।

तो क्या मैं इसे हल कर सकता हूं? मैं से

http://www.codeproject.com/KB/WCF/9StepsWCF.aspx

प्रमाण पत्र निर्माण

makecert.exe -sr CurrentUser -ss My -a sha1 -n CN=WCfServer -sky exchange -pe 
makecert.exe -sr CurrentUser -ss My -a sha1 -n CN=WcfClient -sky exchange -pe 

प्रमाणपत्र इस कोड को कोशिश कर रहा हूँ व्यक्तिगत और विश्वसनीय लोगों में मौजूद है एमएमसी में फ़ोल्डर

सेवा है एक समारोह जो एक संख्या स्वीकार करता है और स्ट्रिंग देता है और ठीक काम करता है

यह मेरी सेवा है web.config:

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpEndpointBinding"> 
      <security> 
      <message clientCredentialType="Certificate" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <services> 
     <service name="WCFServiceCertificate.Service1" behaviorConfiguration="WCFServiceCertificate.Service1Behavior"> 
     <!-- Service Endpoints --> 
     <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" contract="WCFServiceCertificate.IService1"> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <!--<identity> 
      <dns value="localhost"/> 
      </identity>--> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WCFServiceCertificate.Service1Behavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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="false"/> 
      <serviceCredentials> 
      <clientCertificate> 
       <authentication certificateValidationMode="PeerTrust"/> 
      </clientCertificate> 
      <serviceCertificate findValue="WcfServer" 
           storeLocation="CurrentUser" 
           storeName="My" 
           x509FindType="FindBySubjectName" /> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

यह मेरा क्लाइंट कॉन्फ़िग

<system.serviceModel> 
       <bindings> 
    <wsHttpBinding> 
    <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00" 
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
    maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
    textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
     maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
    <reliableSession ordered="true" inactivityTimeout="00:10:00" 
     enabled="false" /> 
    <security mode="Message"> 
     <transport clientCredentialType="Windows" proxyCredentialType="None" 
     realm="" /> 
     <message clientCredentialType="Certificate" negotiateServiceCredential="true" 
     algorithmSuite="Default" establishSecurityContext="true" /> 
    </security> 
    </binding> 
    </wsHttpBinding> 
    </bindings> 
       <client> 
    <endpoint address="http://localhost:1387/Service1.svc" behaviorConfiguration="CustomBehavior" 
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1" 
    contract="ServiceReference1.IService1" name="WSHttpBinding_IService1"> 
    <identity> 
    <certificate encodedValue="AwAAAAEAAAAUAAAA9YoGKvsMLFkeO1WjaCLReQuz1ysgAAAAAQAAALUBAAAwggGxMIIBX6ADAgECAhDDvb3bnmzhsERpNTWEBYQXMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMTEwMzA0MDcwNzU3WhcNMzkxMjMxMjM1OTU5WjAUMRIwEAYDVQQDEwlXY2ZTZXJ2ZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM9e4DwCDYJ4l6myt1QadHzXoqCH2wa1aUjiab1aK/7d/1LZ00KfPJw8kKB358serjEi9SMg0UeyGtl0+byJ8PqShfv4MUTHZcPaWy99vHaYHwH7T9hVwY5RANBWyFy6nf1rXDh/cB2qm0Q/xN5xElOtheFqUoL8Ua6fcP33BAWPAgMBAAGjSzBJMEcGA1UdAQRAMD6AEBLkCS0GHR1PAI1hIdwWZGOhGDAWMRQwEgYDVQQDEwtSb290IEFnZW5jeYIQBjdsAKoAZIoRz7jUqlw19DAJBgUrDgMCHQUAA0EAKlaHJQNdC9VgPuHlVuniQJd+fHoVOU62nl374iXYdQus5KDgKz9RHWAtjhpToBB4sOXOnwTkJfcyJWBf6J14Mw==" /> 
    </identity> 
    </endpoint> 
    </client> 
       <behaviors> 
         <endpointBehaviors> 
           <behavior name="CustomBehavior"> 
             <clientCredentials> 
               <clientCertificate findValue="WcfClient" 
           x509FindType="FindBySubjectName" 
           storeLocation="CurrentUser" 
           storeName="My"/> 
               <serviceCertificate> 
                 <authentication certificateValidationMode="PeerTrust"/> 
               </serviceCertificate> 
             </clientCredentials> 
           </behavior> 
         </endpointBehaviors> 
       </behaviors> 
     </system.serviceModel> 

और बस इस

Service1Client obj = new Service1Client(); 
      Response.Write(obj.GetData(12)); 

का उपयोग कर अब जब मैं सब कुछ एक मुद्दा बिना ठीक काम करता है चलाने के ग्राहक अंत में सेवा को फोन है।

जैसा कि आप सेवा सर्वर पर सेवा चला रहे हैं।

लेकिन जब मैं सेवा IIS में यह मुझे एक त्रुटि देता है कि

X.509 प्रमाणपत्र निम्न खोज मानदंडों का उपयोग नहीं खोजा जा सका मेजबानी करने के लिए प्रयास करें: StoreName 'मेरा', StoreLocation 'CurrentUser', FindType 'FindBySubjectName', FindValue 'WCFServer'।

तो क्या मैं इसे हल कर सकता हूं?

उत्तर

13

x0n का उल्लेख है, कैसिनी आपके वर्तमान उपयोगकर्ता के रूप में चलेंगे, लेकिन आईआईएस आईयूएसआर के रूप में चलाएगा।इस से प्रमाणपत्र आयात करें, निजी कुंजी के साथ, LocalMachine \ व्यक्तिगत (LocalMachine \ मेरे) में, और बदलने के लिए आपकी सेवा config:

 <serviceCertificate findValue="WcfServer" 
          storeLocation="CurrentUser" 
          storeName="My" 
          x509FindType="FindBySubjectName" /> 

इस के लिए:

 <serviceCertificate findValue="WcfServer" 
          storeLocation="LocalMachine" 
          storeName="My" 
          x509FindType="FindBySubjectName" /> 
0

स्पष्ट रूप से प्रमाणपत्र कॉन्फ़िगर किए गए स्थान में नहीं मिला है। सुनिश्चित करें कि आप सेवा चलाने के लिए किस उपयोगकर्ता का उपयोग करते हैं। हो सकता है कि सेवा स्थानीय सिस्टम खाते या स्थानीय सेवा खाते या आईआईएस उपयोगकर्ता पर चल रही हो और आपने प्रमाण को एक अलग उपयोगकर्ता के रूप में स्थापित किया हो? एमएमसी में सेवा के लिए उपयोग की जाने वाली सेवा राशि या अन्य खाते में कैर्ट देखने के लिए स्नैपिन जोड़ें (वर्तमान उपयोगकर्ता नहीं)।

+0

धन्यवाद आपके पता चलता है। मैंने सर्वर पर उपयोग किया लेकिन क्लाइंट को सेवा त्रुटि मिली: –

+0

क्लाइंट प्रमाणपत्र प्रदान नहीं किया गया है। क्लाइंट क्रेडेंशियल में क्लाइंट प्रमाणपत्र निर्दिष्ट करें। –

1

कंप्यूटर स्टोर के लिए "My" में प्रमाणपत्र स्थापित करें ताकि यह सभी उपयोगकर्ताओं के लिए उपलब्ध हो सके। आपने इसे वर्तमान उपयोगकर्ता के लिए "माई" में स्थापित किया है। विकास सर्वर वर्तमान उपयोगकर्ता के रूप में चलता है, इसलिए यही काम करता है।

1

आप शायद स्थापित करने के लिए होगा DNS मूल्य, प्रमाण पत्र के नाम पर जिसका अर्थ है, ग्राहक में> endopoint> indentity (के रूप में यह नीचे दिए गए कोड में वर्णित है)

<client> 
     <endpoint address="http://localhost/FrontPMWebServiceSetup111/FpmService.svc" 
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService" 
      contract="FPMServiceReference.IService" name="WSHttpBinding_IService"> 
      <identity> 
      <dns value="WCfServer" /> 
      </identity> 
     </endpoint> 
     </client> 
संबंधित मुद्दे