zoukankan      html  css  js  c++  java
  • 关于wcf跨机器访问的问题

    在wcf跨机器的访问中遇到了各种无法访问的问题,本人也是在通过个人解决问题的基础上发表一下自己的经验,如果还有其他方面可能影响wcf跨机器的问题,还希望大家多多发言!

    好了废话不多说了,正文如下:

    1、设置好wcf的服务端security mode要设置为None,如

     <services>
          <service behaviorConfiguration="metadataBehavior" name="Services.CalculatorService">
            <endpoint address="http://192.168.1.108:9999/calculatorservice" binding="wsHttpBinding"
                bindingConfiguration="NoneSecurity" contract="Contracts.ICalculator"  />
          </service>
        </services>
        <bindings>
          <wsHttpBinding>
            <binding name="NoneSecurity">
              <!--maxBufferPoolSize="12000000" maxReceivedMessageSize="12000000" useDefaultWebProxy="false">
              <readerQuotas maxStringContentLength="12000000" maxArrayLength="12000000"/>-->
              <security mode="None"/>
            </binding>
          </wsHttpBinding>
        </bindings>

    这里要注意的是bindingConfiguration="NoneSecurity",<binding name="NoneSecurity">,<security mode="None"/>这三个地方,一定要设好。

    然后是客户端中的security mode的设置,如

    <binding name="WSHttpBinding_CalculatorService" closeTimeout="00:01:00"
                       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                       bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                       maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                       messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                       allowCookies="false">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                  maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <reliableSession ordered="true" inactivityTimeout="00:10:00"
                  enabled="false" />
              <security mode="None">
                <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                <message clientCredentialType="Windows" negotiateServiceCredential="true" />
              </security>
            </binding>

    这里要注意的是<security mode="None">这里也要设置为None,这样在程序运行的时候才不会粗;

    最后就是一定要注意把服务端的防火墙关掉,不然也无法卡机器访问,好了就这些,如果还有新的可能导致该问题的情况,还请大家发言!

  • 相关阅读:
    打印空格
    进程间的通信
    堆排序算法
    大小端的判断
    bash help
    [Android] How to disable the screen orientation?
    图片的静态动态显示效果
    WPF Threads: Build More Responsive Apps With The Dispatcher
    用node.js+express自建网站发布静态网页
    利用Apache mod_expires 与 mod_headers 实现文件缓存及mod_deflate压缩输出
  • 原文地址:https://www.cnblogs.com/sysmenu/p/3621417.html
Copyright © 2011-2022 走看看