我陷入了非常奇怪的情況,不知道如何解決這個問題。
我有非常簡單的 WCF 服務,可以很好地使用 http 但現在我想將它移到 https。
問題是需要托管的服務器。服務器 IIS 有一個帶有 http 的別名“server-test.local”(不是“localhost”)。可以使用此別名在本地訪問它。并將其映射到帶有 https 的域名(例如,https://rmt.XXXXXXX.com)。
當我將 WCF 部署到該服務器并檢查 WSDL 檔案時,它具有本地別名而不是公共域名的映射。
它顯示http://server-test.local/WCFService/Service.svc (錯誤)
我想要像https://rmt.XXXXXXXX.com/WCFService/Service.svc(正確)這樣的映射
服務 web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<pages controlRenderingCompatibilityVersion="4.0"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer> <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
當我向應用程式添加服務參考時。它添加了以下不正確的端點。
客戶端 App.config(端點)
<endpoint address="http://server-test.local/WCFService/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProcessing"
contract="WCFService.IService" name="BasicHttpBinding_IProcessing" />
我可以通過瀏覽器訪問 url 和 WSDL 檔案,但不能使用任何服務方法。我收到錯誤訊息“沒有可以接受訊息的端點。”
我想我在這里遺漏了一些明顯的東西。請建議我更改。
uj5u.com熱心網友回復:
您可以嘗試更改 web.config 檔案中的一些簡單步驟,詳細資訊可以參考此帖子。
1.在服務的web.config檔案中啟用傳輸級安全:
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
2.使用bindingConfiguration標簽指定系結名稱和behaviorConfiguration標簽配置行為,然后指定托管服務的地址。代碼如下:
<service name="***" behaviorConfiguration="***">
<endpoint address= https://rmt.XXXXXXXX.com/WCFService/Service.svc
binding="basicHttpBinding"
bindingConfiguration="???"
contract="WCFService.IService"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/403261.html
標籤:
上一篇:如何使用react和typescript修復錯誤物件可能為空或未定義?
下一篇:無法讓容器根據其內容展開
