我有一个 WCF 服务库项目。我正在尝试通过在 Visual Studio 中运行 WCF 测试客户端(按 F5)来生成 wsdl 文件。它启动了 WCF 测试客户端,但显示“无法添加服务。服务元数据可能无法访问。确保您的服务正在运行并公开元数据。”。它还给了我以下错误消息。
c:\Users\xxx\AppData\Local\Temp\Test Client Projects\10.0\354421b1-b65e-45fc-8d98-ac87254a5903\Client.cs(911,26):错误 CS0644:“System.ComponentModel.PropertyChangedEventHandler”无法派生来自特殊类“System.MulticastDelegate”
我添加了服务行为来公开元数据,如下所示。我不确定我在这里还缺少什么能够生成 wsdl 文件。谢谢你的帮助!
<services>
<service name="CU.Customer" behaviorConfiguration="Metadata">
<endpoint address="" binding="wsHttpBinding" contract="CU.ICustomer">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint name="mex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/CustomerService/Service1/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Metadata">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>