【问题标题】:ASP.NET WFC Method not found with 404 resource not found errorASP.NET WFC Method not found with 404 resource not found 错误
【发布时间】:2019-05-12 10:54:05
【问题描述】:

这个问题我快疯了: 我写了这段代码:

[ServiceContract]
 public interface Idata
    {
     [WebInvoke(Method = "POST", UriTemplate = "getwinelist", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
        [OperationContract]
        List<Wine> GetWineList();
    }

在我的 web.config 文件中,我有这个:

<services>
  <service name="WineFid.data">
    <endpoint binding="webHttpBinding" contract="WineFid.Idata" behaviorConfiguration="webBehaviour" />
      </service>   
    </services>

我的行为:

<endpointBehaviors>
   <behavior name="webBehaviour">
       <dataContractSerializer maxItemsInObjectGraph="2147483646" />
      </behavior>
    </endpointBehaviors>

如果我指向https://host.mydomain.net/main.svc,它会完美运行并向我展示经典的 Microsoft Web 服务页面,但是当我指向方法时:

https://host.mydomain.net/main.svc/getwinelist

服务器响应“404 resource not found....” 我的错误在哪里? 请注意,该服务托管在 Azure 上

提前致谢!

【问题讨论】:

    标签: asp.net azure web-services wcf


    【解决方案1】:

    我对天蓝色没有任何想法。这是我认为找不到资源错误的原因,请尝试在标签&lt;endpointBehaviors&gt;下添加以下行并尝试是否有帮助。

    <webHttp helpEnabled="true"  automaticFormatSelectionEnabled="true"/> 
    

    【讨论】:

      【解决方案2】:

      我找到了解决方案....在喝了几升咖啡和胃药之后!!!

      问题是由 https 协议引起的...

      添加就够了

       <security mode="Transport" />
      

      节点内部

       <webHttpBinding>
            <binding> 
                  <security mode="Transport" />
      

      Fiuuuuu....感谢大家的关注!

      【讨论】:

        猜你喜欢
        • 2016-08-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-11
        • 2017-02-20
        相关资源
        最近更新 更多