所以,现在我决定将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的路由处理中排除。