使用控制台应用程序托管公开 asp.net ProfileService、ProfileService 和 RoleService 的 WCF 端点

发布于 2024-09-27 09:32:58 字数 1214 浏览 3 评论 0原文

我有一个 MVC Web 应用程序,用作基于控制台的应用程序的接口,该应用程序使用 net.pipe 协议公开一堆 ServiceHost/s。

我想使用 asp.net 会员资格/角色/个人资料提供程序来管理我的用户及其角色和个人资料信息(在控制台应用程序内)。我已经在很多应用程序中这样做了,但通常我直接从 Web 应用程序本身引用这些提供程序。

这是一个很好的步行-通过做几乎我想做的事情,除了我不想在 IIS 中托管 WCF 服务端点,而是在我的控制台应用程序中 - 它最终将成为 Windows 服务。当我尝试通过控制台应用程序托管 ServiceHost 时,出现以下错误:

This service requires ASP.NET compatibility and must be hosted in IIS.  
Either host the service in IIS with ASP.NET compatibility turned on in 
web.config or set the
AspNetCompatibilityRequirementsAttribute.AspNetCompatibilityRequirementsMode 
property to a value other than Required.

现在看来,我无法将该属性设置为“必需”以外的任何属性。

我尝试了另一条路线,该路线使用定义的包装类/接口 此处用于我的身份验证服务,我设法在没有太多麻烦的情况下将其连接到我的 MVC 应用程序中,但这不包括我的授权(使用角色)或配置文件需求。

有没有人对此有解决方案,我不能是唯一尝试这样做的人我不是

I've got an MVC web application that is used as an interface to a Console based app that exposes a bunch of ServiceHost/s using the net.pipe protocol.

I would like to use the asp.net membership/role/profile provider to manage my users and their roles and profile information (Inside the Console Application). I've done this in quite a few apps, but normally I reference these providers directly from the web application itself.

This is a good walk-through on doing pretty much what I would like, except I don't want to host the WCF service endpoints in IIS, but inside my console app - which will eventually become a windows service. When I try and host the ServiceHost through my console application I get the following error:

This service requires ASP.NET compatibility and must be hosted in IIS.  
Either host the service in IIS with ASP.NET compatibility turned on in 
web.config or set the
AspNetCompatibilityRequirementsAttribute.AspNetCompatibilityRequirementsMode 
property to a value other than Required.

Now it seems that I won't be able to set that property to anything other than Required.

I've tried another route which is using the wrapper class/interface defined here for my authentication service, which I managed to get wired into in my MVC app without too much trouble, but this doesn't cover my Authorisation (using roles) or profile needs.

Has anyone got a solution to this, I can't be the only one trying to do this? I'm not

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文