理解了文档内容,但无法进行处理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);
}
}
实在是没有分了 忘大家帮帮我~!!!
你应该是客户端和服务端不是在一个机器上吧。机器访问不到,还是防火墙阻止了呢?
我的防火墙是关闭的啊
这样有影响么?
@btg.yoyo: 你那个配置文件中的127.0.0.1 改为你本地机器的地址 试试