生活随笔
收集整理的這篇文章主要介紹了
asp.net 调用带证书的webservice解决办法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
最近在朋友弄一個調整省政府政務工作流的程序。。
?
需要把當前的信息推送到政務網上,采用的是帶證書的https webservice。。
?
下面說一下實現過程
?
第一步,引用webservice地址,刪除web.config中相關配置。同時安裝好證書
?
用如下數據替換:
?
[html]?view plain
?copy ? <system.serviceModel>????<bindings>??????<customBinding>????????<binding?name="IServiceSoapBinding"?closeTimeout="00:01:00"????????????????openTimeout="00:01:00"?receiveTimeout="00:10:00"?sendTimeout="00:01:00">??????????<textMessageEncoding?maxReadPoolSize="64"?maxWritePoolSize="16"????????messageVersion="Soap11"?writeEncoding="utf-8">??????????????????????<readerQuotas?maxDepth="32"?maxStringContentLength="819200000"?maxArrayLength="1638400000"??????????????maxBytesPerRead="4096000"?maxNameTableCharCount="16384000"?/>??????????</textMessageEncoding>??????????<httpsTransport?manualAddressing="false"?maxBufferPoolSize="52428800"????????????maxReceivedMessageSize="6553600"?allowCookies="false"?authenticationScheme="Anonymous"????????????bypassProxyOnLocal="false"?hostNameComparisonMode="StrongWildcard"????????????keepAliveEnabled="true"?maxBufferSize="6553600"?proxyAuthenticationScheme="Anonymous"????????????realm=""?transferMode="Buffered"?unsafeConnectionNtlmAuthentication="false"????????????useDefaultWebProxy="true"?requireClientCertificate="true"?/>????????</binding>??????</customBinding>????</bindings>????<client>??????<endpoint?address="https://WebService網址/CXFWebService/webservice/iservice"?behaviorConfiguration="endpointBehavior1"?binding="customBinding"?bindingConfiguration="IServiceSoapBinding"?contract="ZwdtServices.IService"?name="ServiceImplPort"?/>????</client>????<behaviors>??????<endpointBehaviors>????????<behavior?name="endpointBehavior1">??????????<dataContractSerializer?maxItemsInObjectGraph="209715200"/>??????????<clientCredentials>????????????<clientCertificate??findValue="證書用戶"?x509FindType="FindBySubjectName"?storeLocation="LocalMachine"?storeName="My"/>????????????<serviceCertificate>??????????????<authentication?certificateValidationMode="None"/>????????????????????????</serviceCertificate>??????????</clientCredentials>????????</behavior>??????</endpointBehaviors>????</behaviors>??</system.serviceModel>??
但在實際調用時,提示找不到對應的證書用戶
?
?
我猜測可能是iis用戶訪問證書有關,那么就在用戶和計算機上都導入證書。運行MMC,打開兩個證書管理器,都把證書導入一次。
如圖
?
?
完成之后,果然錯誤不一樣。。
繼續運行,出現沒有權限的錯誤
?
繼續設計證書權限
?
?
?
OK完成。。。。。
轉載于:https://www.cnblogs.com/4color/p/5691482.html
總結
以上是生活随笔為你收集整理的asp.net 调用带证书的webservice解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。