我有一個WCF REST服務。我驗證了Webconfig文件,並且所有配置項都很好。WCF REST Service EndPoint未找到WebInvoke錯誤
我得到EndPoint未找到與下面的代碼錯誤。我將向GetDateTime方法添加參數。
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
string GetDateTime();
沒有下面的代碼的端點錯誤。
[OperationContract]
[WebGet(UriTemplate = "/")]
string GetDateTime();
我想用WebInvoke得到這個運行。任何幫助表示讚賞!
以下是Web.config文件中的配置詳細信息。
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="SampleRest.Service1" behaviorConfiguration ="ServiceBehaviour">
<endpoint address="" binding ="webHttpBinding" contract="SampleRest.IService1" behaviorConfiguration ="web" >
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
這是我試過的URL。
http://localhost:65317/Service1.svc
你可以發佈你的配置和你嘗試g的網址嗎?等到WebGet方法? – CjCoax 2012-02-24 00:21:16
看到我上面的編輯 – codematrix 2012-02-24 00:24:02