Bra*_*don 7 .net c# rest wcf 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>
Run Code Online (Sandbox Code Playgroud)
然后我看到这篇关于制作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)));
}
Run Code Online (Sandbox Code Playgroud)
这里的任何建议将不胜感激.谢谢你的帮助.
如果您需要更多信息,请与我们联系.
不确定,但我听说要启用 SOAP,您需要使用basicHttpBinding和设置
aspNetCompatibilityEnabled =“真”
我可能是错的,但为什么不尝试呢?
| 归档时间: |
|
| 查看次数: |
1909 次 |
| 最近记录: |