在将webservice部署到iis 7.5时出错

我已经被编程部门要求testing部署他们的一个应用程序。 对于我所知道的应用程序来说,这是一个wpf应用程序的web服务wcf代码c#。 他们确实告诉我他们确实试图把证书直接放在web服务中(为了避免注册ssl证书的麻烦并将它们保存在每个客户端应用程序中)。

到目前为止我没有问题。 但有一个小窍门。

我一直在尝试在本地部署这个东西(确保这个过程是这样做的),一切都很好(没有得到成功的svc加载页面的消息):

blabla成功

svcutil.exe http://###deployment.eslan2.local/Service###.svc?wsdl 

C#

 class Test { static void Main() { //how to blabla client.Close(); } } 

但是当我尝试在我的IISnetworking服务器(IIS2.5的ws2K8R2)上部署web服务时,我得到这个讨厌的,不是真正有用的错误消息:

 Server Error in '/' Application. The specified network password is not correct. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Security.Cryptography.CryptographicException: The specified network password is not correct. 

源错误:

 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [CryptographicException: The specified network password is not correct.] System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) +41 System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) +0 System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags) +335 System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData) +101 Effect.ServiceModel.ServiceBehaviorHandlerAttribute.ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) +623 [ServiceModelException: An error occurs during service management.] Effect.ServiceModel.ServiceBehaviorHandlerAttribute.ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) +1782 System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) +3565 System.ServiceModel.ServiceHostBase.InitializeRuntime() +82 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +64 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +789 System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +287 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1132 

我已经花了三天时间在网上寻找答案,但迄今为止没有任何价值。

我一直在想这不是从我的服务器,但错误来自的代码。

这实际上是一个非常有用的错误消息。

本质上,应用程序不会启动,因为“密码”不正确。 然而,密码是令人困惑的部分,因为这很可能是证书指纹而不是真实的密码。 第一个堆栈跟踪指向试图读取X509证书的.NETencryption提供程序。

看来您的Web服务被configuration为使用证书进行身份validation。 可能在服务器和客户端之间,我不能确定。 无论看起来你需要看一下,看看你的开发环境中是否有实际使用的证书。 它可能这个证书是不被信任在您的生产箱或没有正确加载。

那就是我要从那里开始和去的地方。 很难确切地知道你正在尝试做什么或者你的代码在做什么。 总的来说,虽然它看起来是一个应用程序设置问题,这个网站可能是最小的帮助解决。 如果最终没有成为证书,你可能需要一个pipe理员把问题转移到StackOverflow,在那里你可以得到更精确的WCF帮助。