在wcf服务中无法获取wsdl

  • 本文关键字:获取 wsdl wcf 服务 wcf
  • 更新时间 :
  • 英文 :


当我键入url时,我在windows7中的iis 7中托管了一个服务http://192.160.11.13/Employee/Service1.svc我可以看到以下信息。

svcutil.exehttp://192.160.11.13/Employee/Service1.svc?wsdl

This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:
C#
class Test
{
    static void Main()
    {
        Service1Client client = new Service1Client();
        // Use the 'client' variable to call operations on the service.
        // Always close the client.
        client.Close();
    }
}

当我键入以获取wsdl时http://192.160.11.13/Employee/Service1.svc?wsdl我没有得到wsdl,而是得到了这个错误消息HTTP错误404。找不到请求的资源。

我在这里缺少什么,请让我知道,这样我就可以生成wsdl

谢谢Prince

您得到的错误是http 404,意思是"找不到文件"。

这可能有几个原因:

  • 服务未运行
  • web.config中不允许使用httpget
  • web.config中未设置mex终结点
  • 你没有使用正确的url

在使用svcutil之前,请确保可以通过浏览器访问wsdl文件。

最新更新