2011-06-13 6 views
2

IIS 5.1에서 호스팅하는 WCF 서비스에 대한 클라이언트를 만들려고합니다. 이상한 문제가 있습니다. 브라우저를 통해 서비스에 액세스 할 수 있습니다. 당신은 서비스 "페이지를 만들었습니다,하지만WCF 서비스 클라이언트 문제

svcutil.exe http://my.host.name/SampleService/SampleService.svc?wsdl 

나는 다음과 같은 오류가 취득 (같은 페이지에 의해 제안) 내가는 svcutil를 실행하려고 할 때마다 :

Error: Cannot obtain Metadata from http://localhost.ms.com/SampleService/SampleS 
ervice.svc?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: http://localhost.ms.com/SampleService/SampleService.svc?wsdl 

Metadata contains a reference that cannot be resolved: 'http://localhost.ms. 
com/SampleService/SampleService.svc?wsdl'. 

The HTTP request is unauthorized with client authentication scheme 'Anonymou 
s'. The authentication header received from the server was 'Negotiate'. 

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


HTTP GET Error 
URI: http://localhost.ms.com/SampleService/SampleService.svc?wsdl 

There was an error downloading 'http://localhost.ms.com/SampleService/Sample 
Service.svc?wsdl'. 

The request failed with an empty response. 

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

이 문제의 원인이 될 수 무엇?

편집 : IIS 자체에서 문제가 될 수 있습니까? 예를 들어 사용 권한을 잘못 설정 했습니까?

편집 : 여기 내 Web.config의가있다 :

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 

    <system.serviceModel> 

    <bindings> 
     <basicHttpBinding> 
     <binding name="Basic"> 
      <security mode="None"/> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 

    <services> 
     <service name="DummyService2.SampleService" 
      behaviorConfiguration="DummyService2.SampleServiceBehavior"> 
     <!-- Service Endpoints --> 
     <endpoint address="" binding="basicHttpBinding" contract="DummyService2.ISampleService" 
       bindingConfiguration="Basic" /> 
     <endpoint address="mex" binding="basicHttpBinding" contract="IMetadataExchange" 
       bindingConfiguration="Basic" /> 
     </service> 
    </services> 


    <behaviors> 
     <serviceBehaviors> 
     <behavior name="DummyService2.SampleServiceBehavior"> 
      <!-- 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="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 
+0

web.config (또는 app.config) 파일을 게시하십시오. –

답변

1

나는이 관련 오류라고 생각 : 웹 서비스 암호로 보호 또는 Windows 통합 인증을 사용

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate'.

있습니까? 제대로 기억한다면 svcutil은 웹 서비스에 대한 통합 인증으로 로그온 할 수 없습니다. 브라우저를 사용할 때 인트라넷 환경에서 백그라운드로 인증을 처리하기 때문에 제대로 작동합니다.

하나의 옵션은 wsdl을 수동으로 다운로드하여 저장 한 다음 다운로드 한 wsdl 파일을 사용하여 클래스를 생성하도록 svcutil을 지정하는 것입니다. 아마도 wsdl에서 참조하는 일부 파일을 다운로드하고 참조를 편집해야 할 것입니다.

+0

IISManager의 -> Properties-> DirectorySecurity에서 익명 액세스가 선택되어 있고 지정된 계정에 내 WINDOWS \ Temp, WINDOWS \ Microsoft.NET \ Framework \ 폴더 및 프로젝트 원본 폴더에 대한 액세스 권한이 있습니다. 누락되었습니다. 어떤 것? –