生活随笔
收集整理的這篇文章主要介紹了
asp.net 调用带证书的webservice解决办法
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
最近在朋友弄一個調(diào)整省政府政務(wù)工作流的程序。。
?
需要把當(dāng)前的信息推送到政務(wù)網(wǎng)上,采用的是帶證書的https webservice。。
?
下面說一下實現(xiàn)過程
?
第一步,引用webservice地址,刪除web.config中相關(guān)配置。同時安裝好證書
?
用如下數(shù)據(jù)替換:
?
[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網(wǎng)址/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>??
但在實際調(diào)用時,提示找不到對應(yīng)的證書用戶
?
?
我猜測可能是iis用戶訪問證書有關(guān),那么就在用戶和計算機上都導(dǎo)入證書。運行MMC,打開兩個證書管理器,都把證書導(dǎo)入一次。
如圖
?
?
完成之后,果然錯誤不一樣。。
繼續(xù)運行,出現(xiàn)沒有權(quán)限的錯誤
?
繼續(xù)設(shè)計證書權(quán)限
?
?
?
OK完成。。。。。
轉(zhuǎn)載于:https://www.cnblogs.com/4color/p/5691482.html
總結(jié)
以上是生活随笔為你收集整理的asp.net 调用带证书的webservice解决办法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。