我有一个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