【问题标题】:Location of client-certificate on IIS hosted WCF service used with BizTalk 2013r2与 BizTalk 2013r2 一起使用的 IIS 托管 WCF 服务上客户端证书的位置
【发布时间】:2020-05-21 17:57:17
【问题描述】:

我的 Windows 客户端证书有问题,在我从一位开发人员那里继承的系统上,该开发人员没有记录他的工作就离开了。基本上,当我尝试使用 Postman 连接到 IIS 托管的 Web 服务时,我在事件日志中被告知

使用以下搜索条件找不到 X.509 证书:StoreName 'My'、StoreLocation 'CurrentUser'、FindType 'FindByThumbprint'、FindValue 'THUMBPRINTVALUE'

现在我已经把证书安装到了所有我能想到的地方。

这是对我所做工作的更详细描述。

我有一个 IIS 托管的 WCF 服务,它通过防火墙暴露在互联网上。 WCF服务的URL绑定到BizTalk server 2013r2上的接收位置,接收位置是WCF-WebHttp类型,并且已经为接收位置设置了客户端证书。

我正在使用邮递员连接到上述 URL,已按照文档所述向邮递员注册了客户端证书,并且返回了以下错误页面

HTTP 错误 500.0 - System.ServiceModel.ServiceActivationException

在事件日志查看器中,我得到以下条目:

 Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/62476613
 Exception: System.ServiceModel.ServiceActivationException: The service '/HL7/ORU/R01/HTTPBasic/Service1.svc' cannot be activated due to an exception during compilation.  The exception message is: Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'CurrentUser', FindType 'FindByThumbprint', FindValue '*THUMBPRINTVALUE*'.. ---> System.InvalidOperationException: Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'CurrentUser', FindType 'FindByThumbprint', FindValue '*THUMBPRINTVALUE*'.
   at System.ServiceModel.Security.SecurityUtils.GetCertificateFromStoreCore(StoreName storeName, StoreLocation storeLocation, X509FindType findType, Object findValue, EndpointAddress target, Boolean throwIfMultipleOrNoMatch)
   at System.ServiceModel.Security.SecurityUtils.GetCertificateFromStore(StoreName storeName, StoreLocation storeLocation, X509FindType findType, Object findValue, EndpointAddress target)
   at System.ServiceModel.Security.X509CertificateRecipientServiceCredential.SetCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, Object findValue)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.BtsServiceHostBase.SetServiceCertificate()
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.BtsServiceHostBase.InitializeRuntime()
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
 Process Name: w3wp
 Process ID: 7080

我知道这个错误意味着什么,它在 StoreName 'My'、StoreLocation 'CurrentUser' 中找不到带有指纹 THUMBPRINTVALUE 的证书。

在这种情况下,谁是 CurrentUser,我已将证书指纹 THUMBPRINTVALUE 添加到以下用户,这些用户是我认为与 web 服务相关联的所有用户。

  • IIS 服务帐户
  • BizTalk 服务帐户
  • 与 IIS 托管 WCF 服务的应用程序池关联的用户

我错过了什么?

【问题讨论】:

    标签: wcf iis biztalk client-certificates biztalk-2013


    【解决方案1】:

    HTTP 500 错误通常表示服务器运行状态有问题。它与客户端无关。
    确实有一项服务可以使用证书对客户端进行身份验证。在这种情况下,我们需要提供客户端证书来调用服务。但是,从错误消息来看,服务器端的 WCF 存在问题。致电前请确认服务是否正常运行。建议您在浏览器中访问以下 URL 页面,检查服务是否正常运行。

    https://myserver/service1.svc

    结果。

    对于 IIS 中托管的 WCF 需要服务证书,这通常由 IIS 中的站点绑定模块完成。
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl
    如果有什么可以帮助的,请随时告诉我。

    【讨论】:

    • 当我按照你的建议通过 URL 访问它时,我得到了一个
    • 您好,请问您的问题解决了吗?服务正常吗?
    猜你喜欢
    • 2015-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-01
    • 1970-01-01
    • 2011-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多