0
我使用.NET 4 WCF,露出下面的REST的Web服务满合并冗余声明的REST全WCF服务
[OperationContract]
[WebGet]
void Test();
由于这是一个面向开发人员的程序,我要支持REST-完整的HTTP开发人员以及喜欢使用WSDL的开发人员。我的做法是申报服务两次以暴露传统的WSDL,也是一个REST端点:
的Web.config
<serviceHostingEnvironment aspNetCompatibilityEnabled="True" multipleSiteBindingsEnabled="true" >
<serviceActivations >
<add relativeAddress ="~/KeyService.svc" service="SecretDistroMVC3.Services.KeyService3"/>
</serviceActivations>
</serviceHostingEnvironment>
的Global.asax
void Application_Start(object sender, EventArgs e)
{
// The following enables the WCF REST endpoint
//ASP.NET routing integration feature requires ASP.NET compatibility. Please see
// 'http://msdn.microsoft.com/en-us/library/ms731336.aspx
RouteTable.Routes.Add(new ServiceRoute("KeyService3", new WebServiceHostFactory(), typeof(KeyService3)));
问题
由于我不喜欢在两个位置声明服务,所以d o我可以在配置中配置两个端点,或者在Application_Start
中配置两个端点?
例子
这会支持内置于WCF的/ help扩展吗? (以上链接),也可以无延伸操作? – LamonteCristo 2011-05-09 15:17:26
嗯,我还没有尝试混合REST工具包配置像“
2011-05-09 16:11:24