0
私は現在、VS 2005を使用してC#でRESTful WCFサービスを作成しています。私はIIS経由でサービスをホストしていますが、.svcを参照できますが、 404エラー。 wcftestclient(VS 2008に含まれています)を実行すると、そのメソッドを見ることができるので、サービスが機能していることがわかります。この問題は実装のREST部分にあるようです。IISでRESTful WCFをホストする
これは私のweb.configファイルである:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service behaviorConfiguration="ServiceBehavior" name="MyAPI">
<endpoint binding="webHttpBinding" contract="IExternalAPI"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
は、これは契約です:
[ServiceContract()]
interface IExternalAPI {
[OperationContract]
[WebGet (BodyStyle=WebMessageBodyStyle.Bare,ResponseFormat=WebMessageFormat.Json,UriTemplate="{APIKey}/Favorites/{userId}")]
string GetFavoritesList(string APIKey, string userId);
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/Addresses/{userId}")]
string GetAddressList(string APIKey, string userId);
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/Authenticate/{userName}/{password}")]
string Authenticate(string APIKey, string username, string password);
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/Checkout/{orderId}/{userId}/{tip}/{addressId}")]
string Checkout(string APIKey, string orderId, string userId, string tip, string addressId);
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/AddToOrder/{templateId}/{userId}")]
string AddFavoriteToOrder(string APIKey, string templateId, string userId);
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/Pending/{userId}")]
string GetPendingOrders(string APIKey, string userId);
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "Bob")]
string TestMethod();
}
任意の助けをいただければ幸いです。
使用しているソフトウェアのバージョンは何ですか? –
あなたはどのURIにナビゲートしていますか?あなたにサンプルを教えてもらえますか? //localhost/MemberServices/MemberServices.svc/Bob ます。http: –
URIは 、HTTPのようなものです//localhost/MemberServices/MemberServices.svc/1234/Favorites/567 私はすべてのサービスパックとVS 2005を実行しています、IIS 5.1、および.NET 3.5 –