Asp.net 已添加具有相同密钥的项。IIS WCF Rest
我用我的Asp.net应用程序托管WCF Rest服务,并且Asp.net兼容模式已打开,它工作正常 当我从visual studio运行应用程序时,但当我在IIS7中运行应用程序时,访问端点时出现错误,显示“已添加具有相同键的项。” 我的服务是CodAsp.net 已添加具有相同密钥的项。IIS WCF Rest,asp.net,wcf,rest,iis-7,Asp.net,Wcf,Rest,Iis 7,我用我的Asp.net应用程序托管WCF Rest服务,并且Asp.net兼容模式已打开,它工作正常 当我从visual studio运行应用程序时,但当我在IIS7中运行应用程序时,访问端点时出现错误,显示“已添加具有相同键的项。” 我的服务是Cod [ServiceContract] [AspNetCompatibilityRequirements (RequirementsMode = AspNetCompatibilityRequirementsMode.Allowe
[ServiceContract]
[AspNetCompatibilityRequirements
(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class RestService
{
[OperationContract]
[WebGet(UriTemplate = "Site/{Id}", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
public Site GetSite(string Id)
{
return new Site(1);
}
}
全球ASCX是
protected void Application_Start ()
{
RouteTable.Routes.Add(new ServiceRoute("Rest", new WebServiceHostFactory(), typeof(RestService)));
}
和web.config
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
请注意,在VS2010模式下一切正常,但在托管IIS 7时出错
并访问
有什么建议吗?在IIS中的“预先设置”下,然后启用DD协议。我关闭了https,它工作正常。
这是一个获奖答案。我被同一个恼人的问题困扰了一个小时,无意中发现了阿卜杜拉的帖子,删除了https协议,突然间一切都变得完美起来。