0
可能性の重複:
Bad Request 400 while accessing WCF Rest service (WebGet)のWebGet方法WCF RESTサービスアプリケーションでエラー400に "不正な要求" を与える
こんにちはすべて、
私は私がやっているかを説明しましょうWCF休憩サービス。ここに私のコードや設定があります:インタフェース
public class DNNService : IDNNService
{
public string SayHello(string Name)
{
return string.Format("Hello {0}", Name);
}
}
設定ファイル
01を実装しIDNNServiceインタフェース
[ServiceContract] public interface IDNNService { [WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "hello/{Name}")] [OperationContract] string SayHello(string Name); }
Serviceクラス私は、WSDL
で正しい情報を返す私のSVCファイルを生成することが可能ですが、私は私の実際のメソッドにアクセスしようとすると問題がある
<system.serviceModel> <services> <service behaviorConfiguration="DNNServiceBehavior" name="DNNService"> <endpoint address="" binding="wsHttpBinding" contract="IDNNService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <endpoint address="rest" binding="webHttpBinding" behaviorConfiguration="httpBehavior" contract="IDNNService"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="DNNServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="httpBehavior"> <webHttp/> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel>
http://localhost/DC560X_rest/DesktopModules/DNNCentric-RestService/Entities/DNNService.svc/rest/hello/prabhakar
- IE Dispaly 「400 Bad Request」
- Firefox表示ブランクページ
私を助けてください。あなたのURLは、リスなどのようにナッツに見える
なぜあなたのURIテンプレートに2つの「}」がありますか? –
申し訳ありませんが、それはタイプミスでした。 –
サービスの呼び出しに使用したホスティングコードと設定、URLも表示できますか? –