代码之家  ›  专栏  ›  技术社区  ›  Jim Lamb

在中配置简单的WCF服务端点ASP.NETMVC 2.0版

  •  2
  • Jim Lamb  · 技术社区  · 15 年前

    所以,现在我决定将AtomPub逻辑移到MVC应用程序中的WCF服务。我创建了一个名为AtomPub.svc公司. 我把以下内容添加到我的web.config文件文件:

    <system.serviceModel>
      <behaviors>
        <serviceBehaviors>
          <behavior name="">
            <serviceMetadata httpGetEnabled="true" />
            <serviceDebug includeExceptionDetailInFaults="false" />
          </behavior>
        </serviceBehaviors>
      </behaviors>
    </system.serviceModel>
    

    还有,我的AtomPub.svc.cs文件代码隐藏如下:

    namespace Web
    {
        using System.ServiceModel;
        using System.ServiceModel.Web;
    
        [ServiceContract]
        public partial class AtomPub
        {
            [WebGet(UriTemplate = "?test={test}")]
            [OperationContract]
            public string DoWork(string test)
            {
                return test;
            }
        }
    }
    

    我还添加了一个路由排除,将这个端点从MVC的路由处理中排除。

    1 回复  |  直到 12 年前
        1
  •  1
  •   Jim Lamb    15 年前