C# WCF-自动生成的WSDL不工作
我有一个WCF服务MyService.svc,托管在IIS 7中。服务的配置如下所示:C# WCF-自动生成的WSDL不工作,c#,.net,wcf,wsdl,svcutil.exe,C#,.net,Wcf,Wsdl,Svcutil.exe,我有一个WCF服务MyService.svc,托管在IIS 7中。服务的配置如下所示: <system.serviceModel> <services> <service name="MyService"> <endpoint address="" binding="basicHttpBinding" contract="MyPortType"></endpoint> </servi
<system.serviceModel>
<services>
<service name="MyService">
<endpoint address="" binding="basicHttpBinding" contract="MyPortType"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="defaultBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
问题是,我的服务不提供自动生成的WSDL(将?WSDL添加到服务的URL),尽管我包含了标记
<serviceMetadata httpGetEnabled="true" />
如果我尝试通过SoapUI调用它,那么服务本身正在工作。当我尝试访问WSDL时,得到HTTP错误400,并且没有WSDL响应
需要注意的是,我使用.NET3.5和VisualStudio2008是出于遗留原因(这是一个旧应用程序)。数据协定是使用VS2008中的svcutil.exe通过命令行生成的。当我在VS 2013/.NET 4.5下尝试相同的服务和配置时(VS2013中带有svcutil.exe的regenerad数据协定类),自动生成的WSDL看起来没有问题
如何使自动生成的WSDL在.NET3.5/VS2008下工作
谢谢,,
迈克尔如果你删除了你行为的名字,它应该会把它捡起来
<serviceBehaviors>
<behavior name="defaultBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
到
将元数据端点添加到服务
<services>
<service name="MyService">
<endpoint address="" binding="basicHttpBinding" contract="MyPortType"></endpoint>
<endpoint address=”mex” binding=”mexHttpBinding” contract=”IMetadataExchange”/>
</service>
</services>
我试过这个,不幸的是它不起作用。行为还是一样。不过还是谢谢你。
<services>
<service name="MyService">
<endpoint address="" binding="basicHttpBinding" contract="MyPortType"></endpoint>
<endpoint address=”mex” binding=”mexHttpBinding” contract=”IMetadataExchange”/>
</service>
</services>