首页 新闻 会员 周边

wcf 以winform当宿主 本地测试Ok。 局域网访问有问题!! 求教!!!!!

0
[待解决问题]

理解了文档内容,但无法进行处理WSDL文档包含无法解析的链接下载“http://127.0.0.1:3721/CalculatorService/mex?xsd=xsd0时出错。
无法连接到远程服务器
由于目标机器积极拒绝,无法连接127.0.0.1:3721下“http://192.168.100.108:3721/CalculatorService/mex$metadata”时出错。请求失败,HTTP 状态为 405: Method Not Allowed。

宿主的配置

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
   <section name="artech.batchingHosting" type="WinFormHost.BatchingHostingSettings,WinFormHost"></section>
  </configSections>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mex4Cal">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://127.0.0.1:3721/CalculatorService/mex"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="CalService" behaviorConfiguration="mex4Cal">
        <endpoint address="http://127.0.0.1:3721/CalculatorService"
                  binding="wsHttpBinding"
                  contract="ICal" >     
        </endpoint>       
      </service>
    </services>
  </system.serviceModel>
  <artech.batchingHosting>
    <add type="WinFormHost.CalculatorService,WinFormHost"></add>
  </artech.batchingHosting>
</configuration>

 

 

namespace WinFormHost
{
    [ServiceBehavior(ConfigurationName="CalService")]
   public class CalculatorService:ICalculator
    {
       public double Add(double x, double y)
       {
           return x + y;
       }
       public double Subtract(double x, double y)
       {
           return x - y;
       }
       public double Multiply(double x, double y)
       {
           return x * y;
       }
       public double Divide(double x, double y)
       {
           return x / y;
       }
    }
}

 

 


namespace WinFormHost
{
    [ServiceContract(ConfigurationName="ICal")]
  public  interface ICalculator
    {
        [OperationContract]
        double Add(double x, double y);
        [OperationContract]
        double Subtract(double x, double y);
        [OperationContract]
        double Multiply(double x, double y);
        [OperationContract]
        double Divide(double x, double y);
    }
}

 

 

实在是没有分了  忘大家帮帮我~!!!

WCF
btg.yoyo的主页 btg.yoyo | 初学一级 | 园豆:67
提问于:2012-11-12 17:44
< >
分享
所有回答(1)
0

你应该是客户端和服务端不是在一个机器上吧。机器访问不到,还是防火墙阻止了呢?

chenping2008 | 园豆:9836 (大侠五级) | 2012-11-12 21:05

我的防火墙是关闭的啊

这样有影响么?

支持(0) 反对(0) btg.yoyo | 园豆:67 (初学一级) | 2012-11-12 21:07

@btg.yoyo: 你那个配置文件中的127.0.0.1 改为你本地机器的地址 试试

支持(0) 反对(0) chenping2008 | 园豆:9836 (大侠五级) | 2012-11-13 10:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册