2011-02-03 4 views
4

그래서 WCF 서비스 응용 프로그램을 만들고 IIS7에서 호스팅했습니다. 현재 'helloworld'테스트 방법이 몇 가지 있습니다. enter image description hereWCF 웹 서비스 작업 표시

지금은 서비스 자체가 잘 작동하지만, 어떻게 내가 같이 작업을 표시 할 수 있습니다 : enter image description here

감사를 링크에 대한 marc_s에 : 내 브라우저에서 실행하면 나는이 화면을 얻을 http://www.dotnetcurry.com/ShowArticle.aspx?ID=399을하는 웹 설정이 다음과 같이 설정되어 있으므로 따라갔습니다 :

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="WcfServer.Service1"> 
     <endpoint address="" binding="webHttpBinding" contract="WcfServer.IService1" behaviorConfiguration="HelpBehaviour" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- 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> 
     <endpointBehaviors> 
     <behavior name="AjaxBehavior"> 
      <enableWebScript /> 
     </behavior> 
     <behavior name="HelpBehaviour"> 
      <webHttp helpEnabled="true"/> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
     <directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension" /> 
    </system.webServer> 
</configuration> 

그러나이 방법은 로컬에서만 작동합니다. IIS7에서 내 서버에 게시 할 때 도움말 링크를 클릭하면 404 오류 페이지가 표시됩니다. 누구나 이것이 왜, 또는 전에 왔는지 알고 있습니까?

는 (마지막 비트는 실행에 의해 해결되었다 : aspnet_regiis.exe -iru) 당신이 SOAP 바인딩 함께 WCF 서비스가있는 경우

+0

당신은 C에서 WCF를 테스트의 WcfTestClient를 사용하여 최고 Studio 10.0 \ Common7 \ IDE (VS 2010) –

+0

이것은 내가했던 첫 번째 작업입니다. –

답변

9

, 당신은 불행하게도 운이있어 : 목록을 얻을 수있는 상자의 밖으로 WCF의 방법이 없습니다 모든 서비스가있는 ASMX와 유사합니다.

REST 바인딩 (webHttpBinding) 및 .NET 4.0을 사용하면 URI 템플릿, 지원되는 HTTP 메소드 등을 나열한 자동 도움말 페이지를 생성 할 수 있습니다. 해당 페이지를 어느 정도 조정할 수도 있습니다. 그 자동 도움말 페이지를 생성해야하기 위해

, 당신은 엔드 포인트의 동작 정의 (참조)해야합니다

<behaviors> 
    <endpointBehaviors> 
     <behavior name="HelpBehavior"> 
      <webHttp helpEnabled="true" /> 
     </behavior> 
    </endpointBehaviors> 
</behaviors> 

이 그런 다음 webHttpBinding 엔드 포인트에서 해당 동작을 참조를하면됩니다.

그것에 대해 모든 읽기 : 프로그램 파일 (86) \ 마이크로 소프트 비주얼 \

+2

+1 나는 똑같은 대답을 쓰고 있었다. 나는 단지 도움말 페이지 URL에 REST 서비스의 sufix/help가 추가되었다. http://msdn.microsoft.com/en-us/library/ee230442.aspx –

+0

어떻게 자동 도움말 페이지를 생성 할 수 있습니까? .NET 4.0을 사용 중이며 REST 서비스를 시도했지만 web.config에 정의 된 끝 점이 없습니다. 내가 직접 작성해야 하나? –

+0

"기본 끝점"에 대한 설명이 없으면 정의되지 않은 경우에 사용됩니까? –