【发布时间】:2014-03-03 19:30:37
【问题描述】:
我在共享环境中托管了一个 WCF 服务,其中包含两种不同的方法。一个是返回所需的输出,另一个是端点未找到异常,这是我验证用户的主要方法。
这里描述了场景:
我的 Iservice.cs 如下
[OperationContract]
[WebInvoke(Method="GET", UriTemplate = "Data?Id={id}", ResponseFormat=WebMessageFormat.Json)]
string GetData(string id);
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "Login?InstId={inst}&UserId={user}&pwd={pwd}", ResponseFormat = WebMessageFormat.Json)]
string Authenticate(string inst, string user, string pwd);
然后通过 DAL 验证用户详细信息,这工作正常。我的网络配置如下:
<system.serviceModel>
<!--<serviceHostingEnvironment multipleSiteBindingsEnabled="True" aspNetCompatibilityEnabled="True">
</serviceHostingEnvironment>-->
<serviceHostingEnvironment multipleSiteBindingsEnabled="True">
</serviceHostingEnvironment>
<services>
<service name="WCFDemo.Service1">
<endpoint address="http://www.ekotri.com/Service1.svc" behaviorConfiguration="restfulBehavior"
binding="webHttpBinding" listenUri="/" bindingConfiguration="" contract="WCFDemo.IService1">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://www.ekotri.com" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="restfulBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="restfulBehavior">
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
GetData 工作正常,但 Authenticate 给出端点未找到错误。但它在本地 IIS 上运行良好。
【问题讨论】:
-
尝试使用this documentation启用帮助页面。如果有任何差异,请检查实时和本地 IIS 上的身份验证设置。
-
但是我有共享主机计划,那么如何检查实时服务器上的身份验证设置??
-
您是否尝试将
UriTemplate = "Login?InstId={inst}&UserId={user}&pwd={pwd}"更改为UriTemplate = "helloworld?InstId={inst}&UserId={user}&pwd={pwd}"之类的其他名称。也许有什么东西在你不知情的情况下阻止或修改它。 -
是的,我确实更改了身份验证关键字和类似的东西,但它没有发生......不知道我卡在哪里????
-
您是否尝试将 address="" 留空?对我来说是这样的
标签: .net json wcf web-config endpoint