请教大虾问题,建了个WCF服务,用客户端调试的时候可以正常访问,就是运行.net 2008,可是把客户端发布到IIS上访问WCF服务端时,老是通信错误,这个是什么原因啊,是不是发布到IIS上要改用户权限啊,可我已经把安全验证设置为none了,最近初涉WCF,还望大虾们多多帮助。

解决方案 »

  1.   

    # 建置專案,確定正確無誤後,就可以裝載到 IIS 了。
    # 在 IIS 上建立一個虛擬目錄,「執行權限」設為「僅指令碼」,ASP.NET 版本設為 2.x 版。
    # 將 Warehouse.svc、Web.config 及 bin 目錄 copy 到虛擬目錄下,如此即完成裝載。http://www.dotblogs.com.tw/dotnetfactory/archive/2008/09/29/5521.aspxhttp://sites.google.com/site/stevenattw/dot-net/wcf/configuring-hosting-in-iis参考看看
      

  2.   


    你说的那写应该没问题的,我在windows service 发布网站的,而且WCF服务宿主是一个控制台程序,客户端是Web,在调试模式下没有问题,就说发布成网站后改什么地方的配置啊
      

  3.   

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      
      <appSettings>
        <add key="LogPath" value="E:\Log"/>
      </appSettings>  <connectionStrings>
        <add name="LogDBConnectionString" connectionString="server=192.168.1.100;database=LogDB;uid=betterDEV;pwd=better2008" />
      </connectionStrings>  <!--服务端配置================================================-->  <system.serviceModel>
        <services>
          <service name="Better.WCFLogService.LogService">
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:9000/Server"/>
              </baseAddresses>
            </host>
            <endpoint address="logserver"
                      binding="wsDualHttpBinding"
                      bindingConfiguration="wsHttpBindingConfiguration"
                      contract="Better.WCFLogService.ILogService">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
          </service>
        </services>    <bindings>
          <wsDualHttpBinding>
            <binding name="wsHttpBindingConfiguration">
              <security mode="None" >
                <message clientCredentialType="None" negotiateServiceCredential="false" />
              </security>
            </binding>
          </wsDualHttpBinding>
        </bindings>
      </system.serviceModel>
      <!--服务端配置================================================--></configuration>
      

  4.   

    <!--WCF客户端配置================================================-->
      <system.serviceModel>
        <client>
          <endpoint name="SubscriptionService"
                    address="http://localhost:9000/Server/logserver"
                    binding="wsDualHttpBinding"
                    bindingConfiguration="SubscriberBindingConfiguration"
                    contract="WebApplication1.ILogService"/>
        </client>    <bindings>
          <wsDualHttpBinding>
            <binding name="SubscriberBindingConfiguration" clientBaseAddress="http://localhost:9001/services" >
              <security mode="None">
                <message clientCredentialType="None" negotiateServiceCredential="false"/>
              </security>
            </binding>
          </wsDualHttpBinding>
        </bindings>  </system.serviceModel>
      <!--客户端配置================================================-->
      

  5.   

    最近做项目用WCF,好像网上资料也不多,大都大同小异,碰到问题好难受,每次几个小时才能解决一些个小问题,大家共勉下,平时碰到什么细节问题发出来共享下,多谢
      

  6.   

    参考
    http://bbs.cnw.com.cn/thread-152845-1-1.html
    http://wenku.baidu.com/view/0d71de3a580216fc700afdf4.html
    http://bbs.cnw.com.cn/thread-178115-1-1.html
      

  7.   

    终于解决了,是WCF双工通信的缘故,我用的是wsDaulHttpBinding,因为Http协议天生不是双工通讯的,所以要想双工通讯,必须在客户端再启用一个端口来做回调端口,这样如果发布后就会端口冲入,引发“通信”出错的问题,把IsOneAway设置为true,就可以了,然后再根据IIS实际分配的服务器端口设置配置文件config,通过...继续研究Http双工通信,寄宿IIS使用,努力中...
      

  8.   

    终于解决了,是WCF双工通信的缘故,我用的是wsDaulHttpBinding,因为Http协议天生不是双工通讯的,所以要想双工通讯,必须在客户端再启用一个端口来做回调端口,这样如果发布后就会端口冲入,引发“通信”出错的问题,把IsOneAway设置为true,就可以了,然后再根据IIS实际分配的服务器端口设置配置文件config,通过...继续研究Http双工通信,寄宿IIS使用,努力中...