是不是象webservice一样需要将wcf放在iis里啊?
多谢指教! 

解决方案 »

  1.   

    wcf服务宿主管理可以让IIS托管,也可以是自己开发的winform程序去托管。
    和remoting一样。建议自己开发winform程序去托管,就是管理服务端的配置文件,可以再做一个单独的服务配置文件。
      

  2.   

    什么意思 小弟不才 听不太明白
    希望讲详细点 或者举个例子我把winform程序的exe 和 app.config文件 
    拉到别人机器上 然后在app.config中配置一下 有点问题报错说是没有认证!
      

  3.   

    你的服务需要一个托管进程来执行,就行webservice是在IIS中托管。
    而wcf和remoting 可以自己 做程序托管,(在iis中也可以托管和webservice一样)。
    具体的实现细节你到网上查查remoting 的或者wcf有个例子  ..\WinFXSamples\WCFSamples\TechnologySamples\Basic\Service\Hosting\SelfHost,你可以看下,目的就是管理配置文件。服务端有一个配置文件,你可以把这个配置文件分成2个去管理,WCF 不就是ABC吗(address,bingding,contract),都是在配置文件中配置的,你管理下这个文件就可。
      

  4.   

    <client>
                <endpoint address="http://localhost:8001/servicemodelsamples/service"
                    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPurchaseRequestService"
                    contract="OrderApplication.WCFService.IPurchaseRequestService"
                    name="WSHttpBinding_IPurchaseRequestService">
                    <identity>
                        <userPrincipalName value="SK\Administrator" />
                    </identity>
                </endpoint>
     </client>这是客户端的配置文件 我把address="http://localhost:8001/servicemodelsamples/service"
    中的localhost换成了我的IP地址在别人机器上 !通过跟程序在调用WCF中的方法时报错:服务没有认证
      

  5.   

    <identity>
    <userPrincipalName value="SK\Administrator" />
    </identity>  这句你在服务端有对应的identity吗?如果没有的加上对应的identity,或者都去掉 ,要加的话在服务端 wsHttpBinding 的security节点配置下
      

  6.   

    把客户端和服务端的    wsHttpBinding 的改下   <security mode="Message">
                <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
              </security>
      

  7.   

    我把<identity>
    <userPrincipalName value="SK\Administrator" />
    </identity>去了  还是报一样的错误! 
    如果在wsHttpBinding 的security节点配置的话怎么配置 ?
      

  8.   

    你把<identity>
    <userPrincipalName value="SK\Administrator" />
    </identity>去掉
    服务端改成这样 试试
    <wsHttpBinding>
            <binding name="WSHttpBinding_IMessageService" closeTimeout="00:10:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="52428800" maxReceivedMessageSize="10240000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
              <readerQuotas maxDepth="32" maxStringContentLength="81920000" maxArrayLength="163840000" maxBytesPerRead="40960000" maxNameTableCharCount="163840000" />
              <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
                      <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
          </wsHttpBinding>