2017-01-06 1 views
-1

Json 형식으로 데이터를 반환하는 RESTful 서비스를 만들려고하지만 브라우저에서 열 때 "끝 점이 없습니다"라는 메시지가 나타납니다.WCF 서비스 "끝 점이 없음"오류

여기이

<system.serviceModel> 
<services> 
    <service name="RestService.HelloWorldService"> 
    <!--<endpoint address="" binding="basicHttpBinding" behaviorConfiguration="REST" contract="RestService.IHelloWorldService"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" behaviorConfiguration="REST" contract="RestService.IHelloWorldService" />--> 
    <endpoint address="json" binding="webHttpBinding" behaviorConfiguration="REST" contract="RestService.IHelloWorldService" />   
    <host> 
     <baseAddresses> 
     <add baseAddress="http://localhost:52478/HelloWorldService.svc" /> 
     </baseAddresses> 
    </host> 
    </service> 
</services> 
<behaviors> 
    <endpointBehaviors> 
    <behavior name="REST"> 
     <webHttp/> 
    </behavior> 
    <!--<behavior name="SOAPDemoEndpointBehavior"> 
    <soapProcessing/> 
</behavior>--> 
    </endpointBehaviors> 
    <serviceBehaviors> 
    <behavior>   
     <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
     <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 

과 같은 내 Web.config의 모습은 심지어 F5 또는 Ctrl 키 F5를 통해 (프로젝트를 시작하려고 한 코드

[ServiceContract] 
public interface IHelloWorldService 
{ 
    [OperationContract] 
    [WebInvoke(Method = "GET", 
     ResponseFormat = WebMessageFormat.Json, 
     BodyStyle = WebMessageBodyStyle.Wrapped, 
     UriTemplate = "json/{id}")] 
    string JsonData(string id); 
} 

입니다) 다음 페이지로 이동 stackoverflow 여기에 하나의 대답으로,하지만 아무것도 작동하는 것 같다.

+0

왜 부정 투표입니까? –

답변

3

문제점을 발견했습니다. 주소에 web.config 파일의 끝점 이름을 지정하고 UriTemplate에 json/before {id}를 추가했습니다. 나는 그 중 하나를 제거 할 필요가 있었다.

관련 문제