ASP Net标识在多个应用程序之间共享
我目前有两个ASP.NET网站正在构建,并且正在尝试获得ASP Net Identity(使用EntityFrameWork)。我已经能够在一个站点上获得成功的登录功能,但无法与第二个站点一起使用。
这两个站点都在同一Web服务器上并共享同一数据库。我需要能够在其中一个网站上创建 /管理用户,并让他们能够访问另一个站点。
我对这项技术非常陌生,但是我猜想用户的身份验证方式部分依赖于应用程序相同,但是无法找到有关如何解决此问题的太多信息。
所有的帮助将非常感谢!
I currently have two asp.net websites I'm building and am trying to get Asp Net Identity (using EntityFramework). I've been able to get successful login functionality on one site, but cannot get it to work with the second site.
Both sites are on the same web server and share the same database. I need to be able to create / manage users on one of the sites, and have them be able to access the other site.
I'm very new to this technology, but I'm guessing the way a user is authenticated relies partly on the application being the same, but am unable to find much info on how to resolve this issue.
All help is greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我缺少一些配置设置。我能够使用以下教程来使它工作:
https://www.dotnet4techies.com/2017/12/how-to-share-ahare-authentication-bet-multiple-application-in-application-in-aspnet.html
I was missing some config settings. I was able to get it working using the following tutorial:
https://www.dotnet4techies.com/2017/12/how-to-share-authentication-between-multiple-applications-in-aspnet.html
您的问题不是在应用程序之间共享身份。您的问题是,您在第二个应用程序中无法正确处理无法管理ID的事情。我说的原因是,您声称这两个应用程序在同一Web服务器和同一数据库上。因此,只要您使用相同的工具,另一个应用程序正在工作时,就不应该只有一个应用程序。
如果您的开发工具或语言有所不同,则可能是原因,否则请调试您的第二个应用程序,以确保其连接到正确的数据库。
您可以看到的另一件事是,如果两个应用程序同时运行,并且您在存储ID的第一个应用程序上启动交易,而无需关闭或结束交易,则表将被锁定,第二个应用程序将不会能够访问表,直到释放事务锁。
希望对您有帮助。
Your problem is not with sharing Identity between the apps. Your problem is that there is something you are not doing correctly in the second app that cannot manage the ID. The reason I said so is that you claimed the two apps are on the same web server and same database. So, there shouldn't be a problem peculiar to only one app when the other one is working provided you are using the same set of tools.
If your tools or languages of development are different, then that may be the cause otherwise, debug your second application to ensure it is connecting to the right database.
Another thing you can look at is that, if the two applications are running simultaneously and you start a transaction on the first application on the table storing the ID, without closing or ending the transaction, the table will be locked and the second application will not be able to access the table until the transaction lock is released.
Hope that helps you.