部署到IIS7时的授权问题 [英] Authorization Issues when deployed to IIS7

查看:67
本文介绍了部署到IIS7时的授权问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的asp.net mvc4应用程序,该应用程序启用了Windows身份验证并将其部署到IIS7.然后可以通过Sharepoint页面视图Web部件访问此应用程序.
Web应用程序本身包含单个控制器,带有Html帮助程序Ajax表单的模型和视图.应用程序本身运行良好,没有问题.

我使用了标准的Internet模板,并删除了所有其他视图,模型和控制器.我尚未删除任何脚本文件,因为我不确定哪些脚本文件可以安全删除.

我已经在项目的根web.config中配置了Windows身份验证:

I have a very simple asp.net mvc4 application with Windows authentication enabled and deployed to IIS7. This application is then accessed via a Sharepoint Page view Web part.
The web application itself consists of a single controller, model and view with an Html helper Ajax form. The applcation itself works fine, without problems.

I used the standard internet template and deleted all the other views, models and controllers. I have not deleted any of the script files as I am not sure which ones are safe to do so.

I have configured windows authentication in the project''s root web.config:

<authentication mode="Windows" />
<!--<authorization>
  <deny users="?"/>
</authorization>-->
<identity impersonate="true" userName="domain\serviceaccount" password="pw" />


在IIS中,所有身份验证类型都被禁用,除了;模拟和Windows身份验证.

如您所见,我删除了 deny users =?部分,因为将其包括在内时,问题一直在发生.

问题出在身份验证上,当我在调试模式下在本地运行它时,它可以正常工作.如果我在本地部署到IIS,它可以工作,但必须先浏览几次.另外,其他用户也可以访问我的计算机上托管的站点,但也需要浏览几次.
它也可以在Sharepoint中使用,但是我也需要导航几次,但是远程用户似乎根本无法访问它.

当它不起作用时,它似乎会自动重定向到不存在的login.aspx页.不需要这样做,因为只能从域内部访问此站点,并且所有用户都已通过身份验证.

当我部署到远程服务器时,它根本无法工作.但这似乎是关于所引用库的依赖项的一个完全独立的问题,并且它无法加载程序集.这不是问题/关注点.好吧:)

我的意思是通过几次导航".在浏览器中,我输入URL(即http://host/webapp).如果是第一次访问,通常会失败并显示404错误,并且浏览器中的url已更改为"http://host/webapp/login.aspx".然后删除"login.aspx"部分,然后按Enter.它可能会再次失败,因此我重复此过程.经过两到三次尝试后,它可以工作.在Sharepoint中,我只需单击链接即可转到页面.第一次单击该单击可能无法正常工作,请再次单击几次,然后再尝试2至3次即可.

感谢您的帮助,在此先感谢.
让我知道您是否需要更多信息.
Keith


In IIS all authentication types are disabled except; Impersonation and Windows Authentication.

As you can see, I have removed the deny users = ? section because when it is included the problem occurs all the time.

The problem is with the authentication, when I run it locally in debug mode it works fine. If I deploy to IIS locally it works but I have to navigate there a few times before it does. Also other users are also able to access the site hosted on my machine but also need to navigate there a few times.
It also works in Sharepoint but I will need to navigate there a few times as well, but remote users don''t seem to be able to access it at all.

When it does not work, it seems to be automatically redirecting to a non-existent login.aspx page. It should not need to do this because this site is only accessed from inside the domain and all users are already authenticated.

When I deploy to a remote server, it does not work at all. But that seems to be a completely seperate issue regarding a referenced library''s dependencies and it fails to load the assembly. This is not the question/concern though. Well yet :)

By ''navigating there a few times'', I mean. In the browser I enter in the URL (ie. http://host/webapp). If visiting for the first time it usually fails with a 404 error and the url in the browser has changed to ''http://host/webapp/login.aspx''. I then delete the ''login.aspx'' part and hit enter. It might fail again, so I repeat the process. After two to three attempts it works. Within Sharepoint I can just click a link to go to the page. The first time I click the click, it probably won''t work, click it again a few times and after two to three attempts it works.

Assistance is appreciated, and thanks in advance.
Let me know if you need more info.
Keith

推荐答案

已解决.
我使用Intranet模板(而不是Internet模板)重新创建了该项目.从一开始我就是应该做的.

我之所以使用错误的选项,是因为我在开始时遵循了一个教程,甚至没有看其他可用的选项.
这并不是说我已解决了原始问题.我的理解是,它应该像以前一样工作,但是我不知道在使用不同项目时在后台执行什么操作,而且我没有时间花时间进行调查.

我在加载第三方程序集时遇到的另一个问题就消失了.
所以现在一切都好了-除了我的项目落后了第二天.哦,很好.

谢谢和问候,
基思(Keith)
Resolved.
I recreated the project using the intranet template as opposed to the internet one. Which is what I should have done from the start of course.

The reason I used the wrong one in the first place was that I followed a tutorial when I started and didn''t even look at what other options were available.
This is not to say that I fixed the original problem. My understanding is that it should have worked the way I did it previously but I don''t know what is being done in the background when the different projects are used and I don''t have the time to spend investigating.

The other problem I was having with loading the third party assembly just went away.
So all is good now - except my project is another day behind. Oh well.

Thanks and Regards,
Keith


这篇关于部署到IIS7时的授权问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆