无法通过SvcUtil.exe使用WCF

时间:2014-03-09 11:27:45

标签: wcf visual-studio-2012

我有一个启动并运行的wcf webservice。我还有visual studio 2012.我尝试按照这些教程在控制台应用程序中使用wcf webservice:

http://www.csharptutorial.in/2012/01/cnet-how-to-consume-wcf-web-service-in.html#.UxxME_6x6JA

第一步之一是运行此SvcUtil.exe命令:

C:\ WcfFiles>“C:\ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ Bin \ SvcUtil.exe”http S://service.mycompany.nl/PortalService.svc WSDL

我收到了这个错误:

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.648]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'https://service.mycompany.nl/PortalServic
e.svc?wsdl' using WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.648]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from https://service.mycompany.nl/PortalService.s
vc?wsdl

If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess.  For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.


WS-Metadata Exchange Error
    URI: https://service.mycompany.nl/PortalService.svc?wsdl

    Metadata contains a reference that cannot be resolved: 'https://service.mycompany.nl/PortalService.svc?wsdl'.

    The HTTP request is unauthorized with client authentication scheme 'Anonymou
s'. The authentication header received from the server was 'Basic realm="service
.mycompany.nl"'.

    The remote server returned an error: (401) Unauthorized.


HTTP GET Error
    URI: https://service.mycompany.nl/PortalService.svc?wsdl

    The document was understood, but it could not be processed.
  - The WSDL document contains links that could not be resolved.
  - There was an error downloading 'https://sehapp01.dmz.rubicongroup.local/SEHP
ortalService.svc?wsdl=wsdl0'.
  - The underlying connection was closed: Could not establish trust relationship
 for the SSL/TLS secure channel.
  - The remote certificate is invalid according to the validation procedure.

If you would like more help, type "svcutil /?"

C:\WcfFiles>

1 个答案:

答案 0 :(得分:0)

尝试使用WcfTextClient来使用Wcf。

是否在以下路径中: C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE

在那里你会找到WcfTestClient。

打开它,运行你的Wcf然后在WcftextClient中启动服务,在那里你可以使用并调用方法;)