我正在尝试使用 Svcutil 导出元数据以从本地托管服务生成代理。我不想进入 Visual Studio 并单击“添加服务引用”,因为这是我的学习练习(!)
我使用 svcutil 如下:
Svcutil /d:c:\temp /t:元数据http://localhost/IISCalculatorService/service.svc http://localhost/IISCalculatorService/service.svc
然后生成两个 WSDL 文件:calculatorservice.wsdl 和 tempuri.org.wsdl。不过,我希望它也能生成两个 .XSD 文件。如果没有这些 .XSD 文件,我无法使用 svcutil 生成客户端代码。
我在使用 svcutil 时遗漏了一些东西还是我的理解错误?任何帮助表示赞赏。
这是服务的 web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="CalculatorService.Calculator">
<endpoint address="" binding="basicHttpBinding" contract="CalculatorService.Contracts.ICalculator" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
使用 disco.exe 生成 XSD 文件。http://msdn.microsoft.com/en-us/library/cy2a3ybs%28v=vs.80%29.aspx http://msdn.microsoft.com/en-us/library/cy2a3ybs%28v=vs.80%29.aspx
打开 Visual Studio 命令提示符并编写 discohttp://localhost/IISCalculatorService/service.svc http://localhost/IISCalculatorService/service.svc
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)