简体   繁体   English

客户端证书在 IIS 上的位置托管 WCF 服务与 BizTalk 2013r2 一起使用

[英]Location of client-certificate on IIS hosted WCF service used with BizTalk 2013r2

I have problem with a windows client certificate, on a system I have inherited from a developer who left without documenting his work.我有一个 windows 客户端证书的问题,在我从一个开发人员那里继承的系统上,他没有记录他的工作就离开了。 Basically, when I try to connect to an IIS hosted webservice using Postman, I am told in the event log that基本上,当我尝试使用 Postman 连接到 IIS 托管的 Web 服务时,我在事件日志中被告知

Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'CurrentUser', FindType 'FindByThumbprint', FindValue ' THUMBPRINTVALUE '无法使用以下搜索条件找到 X.509 证书:StoreName 'My'、StoreLocation 'CurrentUser'、FindType 'FindByThumbprint'、FindValue ' THUMBPRINTVALUE '

Now I have installed the certificate into all the places I can think of.现在我已经将证书安装到了所有我能想到的地方。

Here is a more detailed description of what I've done.这是我所做的更详细的描述。

I have a IIS hosted WCF service which is exposed to the internet via a firewall.我有一个 IIS 托管的 WCF 服务,该服务通过防火墙暴露于互联网。 The URL of the WCF service is bound to a receive location on BizTalk server 2013r2, the receive location is of Type WCF-WebHttp, and a client certificate has been set for the receive location. WCF服务的URL绑定到BizTalk server 2013r2上的接收位置,接收位置为WCF-WebHttp类型,并为接收位置设置了客户端证书。

I am using postman to connect to the above URL, having registered the client certificate with postman as the documentation describes, and I get the following error page returned我正在使用 postman 连接到上述 URL,已按照文档所述使用 postman 注册了客户端证书,我收到以下错误页面返回

HTTP Error 500.0 - System.ServiceModel.ServiceActivationException HTTP 错误 500.0 - System.ServiceModel.ServiceActivationException

In the event log viewer I get the following entry:在事件日志查看器中,我得到以下条目:

 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

I know what this error means, that it can't find a certificate with a thumbprint THUMBPRINTVALUE in StoreName 'My', StoreLocation 'CurrentUser'.我知道这个错误意味着什么,它在 StoreName 'My'、StoreLocation 'CurrentUser' 中找不到带有指纹THUMBPRINTVALUE的证书。

In this case, who is CurrentUser, I have added the certificate thumbprint THUMBPRINTVALUE to the following users, who are all the ones I think of that are associated with the webservice.在这种情况下,谁是 CurrentUser,我已将证书指纹THUMBPRINTVALUE添加到以下用户,这些用户是我认为与 Web 服务相关联的所有用户。

  • IIS Service Account IIS 服务帐号
  • BizTalk Service account BizTalk 服务帐户
  • The user associated with the application pool the IIS hosted WCF service与应用程序池关联的用户 IIS 托管 WCF 服务

What am I missing?我错过了什么?

HTTP 500 error typically indicates that there is something wrong with the server running state. HTTP 500错误通常表示运行 state 的服务器出现问题。 It has none business with the client-side.它与客户端无关。
There is indeed a service that authenticates the client with a certificate.确实有一项服务可以使用证书对客户端进行身份验证。 In that case, we need to provide a client certificate to invoke the service.在这种情况下,我们需要提供客户端证书来调用服务。 However, from the error message, there is a problem with the WCF on the server-side.但是从报错信息来看,服务器端的WCF有问题。 Before calling, please confirm whether the service is running normally.致电前请确认服务是否正常运行。 I suggest you visit the below URL page in the browser to check whether the service is running properly.建议您在浏览器中访问下面的URL页面,检查服务是否正常运行。

https://myserver/service1.svc https://myserver/service1.svc

Result.结果。
在此处输入图像描述
For the WCF hosted in IIS requires a service certificate, this is commonly accomplished by the site binding module in IIS.对于IIS中托管的WCF需要服务证书,这通常由IIS中的站点绑定模块来完成。
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl
Feel free to let me know if there is anything I can help with.如果有什么我可以帮忙的,请随时告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM