2011-11-27 9 views
11

मेरे पास मेरी देव मशीन में एक डब्ल्यूसीएफ क्लाइंट है जिसके लिए प्रमाणपत्र की आवश्यकता है और यह ठीक काम कर रहा है।
उत्पादन सर्वर पर तैनाती के बाद मैं निम्नलिखित त्रुटि मिलती है:एएसपी.नेट - निर्दिष्ट नेटवर्क पासवर्ड सही नहीं है

[CryptographicException: The specified network password is not correct.] 

देव - Win7 32 बिट IIS 7.5
उत्पादन - जीत सर्वर 64 बिट 2008 IIS 7.5

हालांकि कोई नेटवर्क के बीच पासवर्ड और प्रमाणपत्र पासवर्ड नहीं है। (मुझे पता है क्योंकि देव कोई पासवर्ड नहीं है)। मेरे पास एकमात्र पासवर्ड है जो डब्ल्यूसीएफ है जो कि DEV के समान है।

CrmServiceClient crm = new CrmServiceClient("CrmServiceEndpoint"); 
crm.ClientCredentials.UserName.UserName = CrmConfigRepository.CrmUserName;//fine 
crm.ClientCredentials.UserName.Password = CrmConfigRepository.CrmPassword;//fine 
crm.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2(Path); 
///THIS WONT WORK AS WELL 
crm.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2(Path, "", X509KeyStorageFlags.Exportable); 

इस पूर्ण ढेर

[CryptographicException: The specified network password is not correct. ] 
    System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) +41 
    System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) +0 
    System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags) +372 
    System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName) +101 
    Externals.CrmConnection.Get() in C:\Users\avi\Documents\Visual Studio 2010\Projects\ExpressBroker\Externals\CrmConnection.cs:31 
    ExpressBroker.Models.ActionsMetadata.Handlers.LeadAccountHandler.Handle(BrokerAction brokerAction, ActionStep step, Dictionary`2 httpPostDataCollection) in C:\Users\avi\Documents\Visual Studio 2010\Projects\ExpressBroker\ExpressBroker\Models\ActionsMetadata\Handlers\LeadAccountHandler.cs:45 
    ExpressBroker.Models.ActionsMetadata.Handlers.BaseStepHandler.SecuredHandle(BrokerAction brokerAction, ActionStep step, Dictionary`2 httpPostDataCollection) in C:\Users\avi\Documents\Visual Studio 2010\Projects\ExpressBroker\ExpressBroker\Models\ActionsMetadata\Handlers\BaseStepHandler.cs:49 
    ExpressBroker.Models.ActionsMetadata.Handlers.HandlerInvoker.Invoke(BrokerAction brokerAction, ActionStep actionStep, Dictionary`2 stepValues) in C:\Users\avi\Documents\Visual Studio 2010\Projects\ExpressBroker\ExpressBroker\Models\ActionsMetadata\Handlers\StepServerInoker.cs:29 
    ExpressBroker.Controllers.LeadAccountController.Register(String step) in C:\Users\avi\Documents\Visual Studio 2010\Projects\ExpressBroker\ExpressBroker\Controllers\LeadAccountController.cs:28 
    lambda_method(Closure , ControllerBase , Object[]) +127 
    System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39 
    System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +129 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +784922 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314 
    System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976 
    System.Web.Mvc.Controller.ExecuteCore() +159 
    System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335 
    System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62 
    System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20 
    System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371 

धन्यवाद

+0

X509 प्रमाणपत्र कन्स्ट्रक्टर में पारित पथ क्या है? मुझे लगता है कि यह प्रमाण पत्र फ़ाइल तक पहुंचने वाला नेटवर्क पासवर्ड है। – Simon

+0

संभावित डुप्लिकेट? http://stackoverflow.com/q/899991/130352 –

उत्तर

32

है इस प्रयास करें:

new X509Certificate2(Path, "", X509KeyStorageFlags.MachineKeySet); 

ऐसा लगता है कि X509Certificate2 निर्माता स्थानीय की निजी कुंजी की दुकान का उपयोग करने की कोशिश करता है उपयोगकर्ता (पीएफएक्स और निजी कुंजी लोड करते समय भी पीएफएक्स में है)। एएसपीनेट के साथ, उपयोगकर्ता प्रोफ़ाइल आम तौर पर लोड नहीं होती है, इसलिए उपयोगकर्ता कुंजी स्टोर मौजूद नहीं है। मशीनकेससेट निर्दिष्ट करना स्थानीय कंप्यूटर कुंजी स्टोर को देखने के लिए निर्माता को बताता है जो हमेशा मौजूद है।

+3

मेरा दिन बचाया ... जब वे क्रिप्टो एपीआई करते थे तो वे क्या सोच रहे थे। यह उन चेतावनियों पर एकमात्र गोचा नहीं है जो मैं ठोकर खा रहा हूं। –

+0

धन्यवाद! मैंने कभी बुरी तरह से नामित वर्ग का उपयोग नहीं किया, लेकिन केवल यह कामकाजी समाधान है! – balint

+0

इसके लिए धन्यवाद! – TheWebGuy

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