をしようとしたとき、私は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 Expressの
の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);
}
}
}
でデバッグを試してみました
私はこの1つを含む件に関する記事の束を読みましたREST/SOAP endpoints for a WCF service。おそらく、カッシーニには何かがあるのでしょうか、私のマシンの設定は何かのことに気づいていますか?私はWindows Vistaの問題を読みましたが、私はWindows 7 Proを使用しています。おそらく、WCFサービスライブラリとは対照的に、WCFサービスアプリケーションと何か関係がありますか?
ありがとうございます!それはうまくいった(facepalm)ので、UriTemplateでは動作しないので、も削除しなければならなかった –