已添加具有相同键的项目。 IIS WCF 休息

An item with the same key has already been added. IIS WCF Rest

我正在使用我的 Asp.net 应用程序托管 WCF Rest 服务,并且 asp.net 兼容模式已打开,它工作正常 当我 运行 来自 visual studio 的应用程序但是当我在 IIS7 中访问端点时出现错误说 "An item with the same key has already been added." 我的服务代码是。

  [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 时出现错误 并访问 http://example.com/rest/site/2 有什么建议吗?

在 IIS 的“高级设置”和“启用协议”下,我关闭了 https,它工作正常。