[英]WCF 4 Soap and Json Endpoint Secured with DotNetOpenAuth
我有一个使用WCF REST服务模板40创建的WCF 4服务项目。
我的目标是将单个WCF服务公开为SOAP端点和返回JSON格式数据的RESTful端点。 必须通过从示例项目复制的DotNetOpenAuth OAuthAuthorizationManager保护两个端点。
因此,我有一个SOAP WCF服务,可以从我的OAuth服务提供商成功授权消费者。 为此,我使用了DotNetOpenAuth服务提供程序示例中的相同配置。
现在,我正在尝试为同一服务设置WCF RESTful JSON响应端点,并保护该端点。 我不确定如何做到这一点。 我最初的想法是让它看起来像这样:
<behaviors>
<serviceBehaviors>
<behavior name="DataApiBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="OAuthServiceProvider.Core.OAuthAuthorizationManager, OAuthServiceProvider" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="DataApiBehavior" name="OAuthServices.DataApi">
<endpoint address="soap" binding="wsHttpBinding" contract="OAuthServices.Interfaces.IDataApi"/>
<endpoint address="json" binding="webHttpBinding" contract="OAuthServices.Interfaces.IDataApi"/>
</service>
</services>
然后我看到这篇关于制作RESTful WCF服务+ DotNetOpenAuth的博客文章: http : //www.theleagueofpaul.com/codesnippet-ooo-openid-odata-oauth-together
我不确定是否设置工厂加服务配置的ServiceAuthorization部分会导致问题。
我也不确定我是否需要在Global.asax中的RegisterRoutes方法中做任何事情:
private void RegisterRoutes()
{
RouteTable.Routes.Add(new ServiceRoute("DataApi", new WebServiceHostFactory(), typeof(DataApi)));
}
这里的任何建议将不胜感激。 谢谢你的帮助。
如果您需要更多信息,请与我们联系。
不确定,但我听说要启用SOAP,你需要使用basicHttpBinding
和set
aspNetCompatibilityEnabled = “真”
我错了,但为什么不试试?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.