问题描述
我刚刚创建了一个托管在我的 Azure 订阅中的网络表单.我通过我的作品 Azure 目录设置了身份验证,以对用户进行身份验证.在调试中,这工作正常,我可以使用我的工作凭据登录,然后通过本地主机查看网站.
I just created a webform that is hosted in my Azure subscription. I set it up with authenication via my works Azure directory for authenticating users. In debug this works fine and I am able to login with my work credentials and then view the website via local host.
我已将此发布到我的 Azure,它说它正在运行并且工作正常.因此,当我尝试连接到该网站时,它会不断将我重定向到本地主机,从而导致错误.
I have published this to my Azure and it says it is running and working fine. So when I try to connect to the website it continuously redirects me to the localhost resulting in an error.
我已经检查了网络配置.
I have checked the web config.
这是发生时的谷歌网络事件链.
Here is the google network chain of events when it occurs.
我真的不知道出了什么问题以及我需要做些什么来解决这个问题,所以任何帮助都将不胜感激.很抱歉我不能提供更多,但我什至不知道从哪里开始或从哪里开始.Azure 中是否有一些设置需要我也添加网站?
I am really lost as to what is wrong and what I need to do to fix this so any help would be greatly appreciated. I'm sorry I can't offer more but I don't even know what is wrong to begin with or where to look. Is there some setting in Azure that I need to add the website too?
推荐答案
我已经解决了这个问题.由于这太痛苦了,我会继续这样做,因为我找不到任何答案.其实很简单.
I have solved this issue. Since it was such a pain I will keep this up as I couldn't find any answers on this. It was actually quite simple.
你有两个选择.我所做的并且有效的方法是更改发布配置文件,如下所示:
You have two options. The one I did and which worked was changing the publish profile as below:
添加进行身份验证的域.因此,如果您的 Web 应用程序由对用户进行身份验证的不同 azure 帐户托管,请使用正在进行身份验证的帐户.
Add the domain where the authentication is occurring. So if you have your web app hosted by a different azure account that which is authenticating the users, use the one that is authenticating.
这将在站点上创建两个版本的应用程序,一个用于本地主机,一个用于实际站点.
This will create two versions of your app on the site one for local host and one for the actual site.
第二个选项(我没有尝试过,但应该可以)是转到您正在对用户进行身份验证的 Azure 帐户,然后转到应用程序,然后进行配置.将 APP URL 从本地主机更改为您尝试访问的 url.
The second option(I have not tried this but it should work) is to go to the Azure account where you are authenticating the users and go to applications and then configure. Change the APP URL from local host to the url you are trying to get to.
这是一个很好的链接,它清楚地解释了如何做到这一点.
Here is an excellent link that explains how to do this clearly.
点击此链接了解详情解释
这篇关于ASP.Net 身份验证后重定向到本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!