簡體   English   中英

我無法使用WSHttpBinding在IIS上部署WCF服務

[英]I Cannot deploy my WCF service on IIS using WSHttpBinding

我真的需要這里的幫助。 我正在嘗試部署過去一個月以來第一次工作的.NET WCF應用程序。

我使用IIS 7作為WCF主機,並使用wsHTTPBinding,因為我需要使用Session對象存儲憑據。 我的客戶是一個使用MVVM模式和Caliburn.Micro的WPF應用程序。

到目前為止,我(成功地)設法在IIS上成功創建了服務。 如果瀏覽http://localhost/Ohmio/OhmioService.svc ”, 則會看到“您創建服務”消息。 但是,當我運行我的客戶端並嘗試連接到它時,我的應用程序關閉,並顯示錯誤消息“該應用程序已停止工作...” bla bla bla。

這是我的服務器Web.Config:

<?xml version="1.0"?>
<configuration>
  <appSettings/>
    <system.web>
    <compilation targetFramework="4.0"/>    
    <authentication mode="Windows"/>    
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <system.webServer>    
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>      
        <binding name="myBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">         
          <readerQuotas maxDepth="200" maxStringContentLength="8388608" maxArrayLength="16384" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
      <security mode="None" />
      <reliableSession enabled="true" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="WcfService1.Service1Behavior" name="WcfService1.OhmioSVC">    
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="myBinding" contract="WcfService1.IOhmioSVC" >          
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService1.Service1Behavior">          
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

這是客戶端App.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IOhmioSVC" maxReceivedMessageSize="20000000"/>
        <security mode="None" />
            <reliableSession enabled="true" />
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost/Ohmio/OhmioService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IOhmioSVC" contract="OhmioSVC.IOhmioSVC" name="WSHttpBinding_IOhmioSVC">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

當然,我的應用程序可以在我的開發機器上正常工作。 請幫忙! 我什至不知道從哪里開始尋找原因。

謝謝!

編輯

好。 我按照建議放了Try catch,錯誤消失了:

例外:由於與遠程端點進行了安全協商,因此無法打開安全通道。

內部異常:

該端點不接受操作,而僅允許處理WSReliableMessaging

我相信這是此副本的副本:

如何使用IIS上托管的wsHttpBinding配置WCF服務並通過Web消耗它?

但是我沒有這樣的聲譽。

我認為問題與可靠的會話有關(不確定性100%,但我的神經告訴我)。 我發現了一些文章,可以幫助您實現可靠的會話。

希望這對您有所幫助:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM