I have an asp.net mvc / angular web app which has been working fine for years. Its just been moved to a new server (Windows 2019, IIS7) and now is throwing many console errors and server errors, eg
我有一个ASP.NETMVC/ANGLING Web应用程序,多年来一直运行得很好。它刚刚被移动到新的服务器(Windows 2019,IIS7),现在抛出了许多控制台错误和服务器错误,例如
DashBoard:1 Refused to apply style from 'http://MyServer/SiteName/Content/assets/css/bootstrap.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Dashboard:1拒绝应用文本中的样式,因为其MIME类型(‘’http://MyServer/SiteName/Content/assets/css/bootstrap.min.css‘/html’)不是支持的样式表MIME类型,并且启用了严格的MIME检查。
Also many 500 errors, even when loading a gif file. The files are all where they should be, I have unblocked them in windows file explorer, the user account running the application pool has full access to the files and is an admin on the IIS server. Authentication mode is windows. I am really out of ideas as to what could be the issue. Most files are served ok (razor views, bundles). I read something about TLS versions but am reluctant to add registry keys as its a clients server. I have a feeling its some fundamental issue with IIS configuration. Anyone have any suggestions?
还有500多个错误,即使在加载gif文件时也是如此。文件都在它们应该在的地方,我已经在Windows文件资源管理器中解锁了它们,运行应用程序池的用户帐户对文件具有完全访问权限,并且是IIS服务器的管理员。身份验证模式为Windows。我真的不知道这可能是什么问题。大多数文件都可以正常使用(如剃须刀视图、捆绑包)。我读到了一些关于TLS版本的东西,但我不愿添加注册表项,因为它是客户端服务器。我有一种感觉,这是IIS配置的一些根本问题。有谁有什么建议吗?
更多回答
How did you move it? Syncing IIS servers with Web Deployment Tool?
你是怎么移动它的?将IIS服务器与Web部署工具同步?
Manually copied files
手动复制的文件
I added request tracing and got this : ModuleName IIS Web Core Notification AUTHENTICATE_REQUEST HttpStatus 500 HttpReason Internal Server Error HttpSubStatus 0 ErrorCode Either a required impersonation level was not provided, or the provided impersonation level is invalid. (0x80070542)
我添加了请求跟踪并得到以下结果:模块名称IIS Web核心通知AUTHENTATE_REQUEST HttpStatus 500 HttpReason内部服务器错误HttpSubStatus 0错误代码未提供所需的模拟级别,或者提供的模拟级别无效。(0x80070542)
I wonder why you chose to manually copy, but in that way you missed all relevant settings and permissions. I suggest you hire an experienced consultant to guide your migration, instead of asking around. Without touching the servers and your web app, it is impossible for anyone here to give proper advice.
我想知道您为什么选择手动复制,但这样您就错过了所有相关的设置和权限。我建议你聘请一位有经验的顾问来指导你的迁移,而不是四处打听。如果不接触服务器和你的Web应用程序,这里的任何人都不可能给出适当的建议。
Thanks for your sage advice.
谢谢你的明智建议。
优秀答案推荐
I solved this by logging onto the IIS server once as the Application Pool user (a non-local service account in this case). This caused the profile of that user to be created locally which must be required by IIS for authentication purposes.
我通过以应用程序池用户(在本例中为非本地服务帐户)身份登录到IIS服务器来解决此问题。这导致在本地创建该用户的配置文件,这是IIS进行身份验证所必需的。
Set load user profile = true in the application pool first, if this alone doesn't work, log onto the iis server as the app pool user.
首先在应用程序池中设置LOAD USER PROFILE=TRUE,如果仅此设置不起作用,请以应用程序池用户身份登录到iIS服务器。
更多回答
That unfortunately shows unfamiliarity of IIS settings. The actual solution is to set loadUserProfile
to true, learn.microsoft.com/en-us/iis/configuration/…. If you use a migration tool like Web Deployment Tool, or hire a consultant, this can be figured out within just a few minutes during migration. But you can easily miss such when merely copying the files over.
不幸的是,这显示出对IIS设置的不熟悉。实际解决方案是将loadUserProfile设置为True,learn.microsoft.com/en-us/iis/Configuration/…。如果您使用Web部署工具之类的迁移工具,或者聘请顾问,在迁移过程中只需几分钟即可解决这一问题。但是,当仅仅复制文件时,您很容易错过这种情况。
Thanks for all your assistance, its really been invaluable.
谢谢你的帮助,这真的是无价之宝。
我是一名优秀的程序员,十分优秀!