나는 REST를 통해 노출 할 아주 기본적인 WCF 서비스에 404가 계속하려고 할 때 - 디버깅 할 때 나는이 URL로 이동하여 액세스하려고 해요 : http://localhost:62888/Service1.svc/xml/data/testWCF REST (404) GET
I을 http://localhost:62888/Service1.svc에서 서비스 정보를 볼 수 있지만 http://localhost:62888/Service1.svc/xml
.Net 4와 WCF 서비스 응용 프로그램 프로젝트를 사용하고 있습니다. 나는 카시니뿐만 아니라 IIS 익스프레스
의 Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Service1">
<!-- address is relative-->
<endpoint address="xml" binding="webHttpBinding" behaviorConfiguration="webHttp" contract="IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp /> <!-- enables RESTful in conjunction with webHttpBinging -->
<enableWebScript /> <!-- allows ajax communication -->
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
IService.cs
using System.ServiceModel;
using System.ServiceModel.Web;
namespace CI.WcfRestTest
{
public interface IService1
{
[OperationContract]
[WebGet(UriTemplate = "/data/{id}")]
string GetData(string id);
}
}
Service1.svc.cs
namespace CI.WcfRestTest
{
public class Service1 : IService1
{
public string GetData(string id)
{
return string.Format("You entered: {0}", id);
}
}
}
과 디버깅을 시도
나는이 하나를 포함하여 주제에 기사의 낱단을 읽었다 REST/SOAP endpoints for a WCF service. 아마도 카시니 (Cassini) 나 내 컴퓨터 구성에 뭔가가있어? Windows Vista 문제를 읽었지만 Windows 7 Pro를 사용하고 있습니다. 아마도 WCF 서비스 라이브러리가 아닌 WCF 서비스 응용 프로그램과 관련이있을 것입니다.
감사합니다. 그건 (facepalm), 나는 또한 UriTemplate와 함께 작동하지 않기 때문에 제거했다 –