简体   繁体   English

Angular 代码在 Visual Studio 中工作,但在 IIS 中不工作

[英]Angular code working in Visual Studio but not in IIS

I have created a project with MVC and Angular.js My app works fine from visual studio.我用 MVC 和 Angular.js 创建了一个项目我的应用程序在 Visual Studio 中运行良好。 But when I Publish it in IIS i get error messages in console saying there are some issues in angular.min.js file.但是当我在 IIS 中发布它时,我在控制台中收到错误消息,说 angular.min.js 文件中存在一些问题。

Console error is: Unknown provider: nProvider <- n控制台错误是:未知提供者:nProvider <- n

I have tried to publish code both in debug and release modes.我试图在调试和发布模式下发布代码。 Nothing is working.没有任何工作。 It is working fine from the visual studio.它在视觉工作室工作正常。

[ [我这是控制台错误的图像1

I faced a similar problem and found that when I try to access the angular.min.js directly in the browser file then it was giving an error,我遇到了类似的问题,发现当我尝试直接在浏览器文件中访问 angular.min.js 时出现错误,

base_url/node_modules/angular/angular.min.js
HTTP Error 404.8 - Not Found

The "request filtering module" is a feature in IIS 7 and above. “请求过滤模块”是 IIS 7 及以上版本中的一个功能。 When IIS rejects a request based on this feature, the error code logged is 404.8.当 IIS 拒绝基于此功能的请求时,记录的错误代码为 404.8。 This feature allows you to define which segments are "Servable".此功能允许您定义哪些段是“可服务的”。

If this is the error you are facing then follow these steps to resolve it.如果这是您面临的错误,请按照以下步骤解决它。

  1. Open the IIS Manager on your Windows server.在 Windows 服务器上打开 IIS 管理器。
  2. Click the website on which you need to modify your settings.单击需要修改设置的网站。
  3. Double click "Request Filtering" from the IIS section and go to the "Hidden Segments" tab.双击 IIS 部分和 go 中的“请求过滤”到“隐藏段”选项卡。
  4. Check whether the folder containing (node_modules) angular.min.js which you are trying to access is under the "Hidden Segments".检查您尝试访问的包含 (node_modules) angular.min.js 的文件夹是否在“隐藏段”下。
  5. If it is present, right-click the particular folder and then remove it.如果存在,请右键单击特定文件夹,然后将其删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM