【发布时间】:2016-07-02 00:48:59
【问题描述】:
我已经开发了托管在 IIS 根目录中的 angularJs 应用程序,即)我让它在 Localhost 中运行。如果我在浏览器中输入 localhost 并回车,我的应用程序就会打开并且运行良好。
问题是,我有一些其他应用程序同时在 localhost 下运行。例如)localhost/hrs、localhost/CMS 等,这些都是 asp.net 应用程序。在我托管 Angular 应用程序后,如果尝试打开我的应用程序,它会在浏览器控制台中显示以下 javascript 错误...
Uncaught Error: ASP.NET Ajax client-side framework failed to load.
ScriptResource.axd:1 Uncaught SyntaxError: Unexpected token <
我多次遇到这两个错误...
我该如何克服这个问题?
仅供参考:- 我已经在我的角度应用程序中实现了路由。还有一件事是 URL 重写,我的 web.config 中如下所示...
<rewrite>
<rules>
<rule name="AngularJS Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="api/(.*)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
我是 angularJS 的初学者。
任何人都可以帮助我...
提前谢谢...
【问题讨论】:
-
当 Angular 应用程序托管在路由中时,您的其他应用程序会受到哪些影响?尝试导航到这些应用程序时是否显示任何错误消息?
-
@ScottLyons 我更新了我的问题...谢谢
标签: javascript html angularjs iis url-rewriting