简体   繁体   English

在服务器上发布后,CSS或Javascript文件不起作用

[英]Css or Javascript files are not working after publish on server

When I launch the web application from Visual Studio with IE it works very fine. 当我从带有IE的Visual Studio启动Web应用程序时,它可以很好地工作。 After publishing the app on a local server in the company It just works on Chrome and firefox. 在公司的本地服务器上发布应用程序后,它仅可在Chrome和Firefox中使用。 When I look at DEveloper Tool from IE, in the styles window, styles of elements which has -ms- tag (for instance -ms-transform) has a wavy red line under iti kind of indicates it does not work. 当我从IE中查看DEveloper Tool时,在样式窗口中,具有-ms-标记(例如-ms-transform)的元素的样式在iti下方有一条波浪线表示它无法正常工作。 But I am using IE. 但是我正在使用IE。 I hope I could explain the situation. 我希望我能解释一下情况。

Paths are all like <script src="Scripts/jquery-ui.js"></script> . 路径都类似于<script src="Scripts/jquery-ui.js"></script> Scripts is a folder and it of course exists in published folder on the server. 脚本是一个文件夹,它当然存在于服务器上的已发布文件夹中。 My IE version is 11.0.9600.17278. 我的IE版本是11.0.9600.17278。 IIS 8.0 is installed on server. IIS 8.0已安装在服务器上。

Edit: By the way some of them are not working, not all of them. 编辑:顺便说一句,有些不是,不是全部。

try 尝试

 <script src="../Scripts/jquery-ui.js" />

also make sure your files are copying from VS when you publish it. 还应确保在发布文件时从VS复制文件。 Additionally if your using some sort of Authentication for users and you are denying user access to all pages through the web.config, you will need to allow users to access scripts. 此外,如果您对用户使用某种身份验证,并且拒绝用户通过web.config访问所有页面,则需要允许用户访问脚本。 This can be done by putting a web.config file in the folder Scripts allowing all anonymous users to access it. 可以通过将web.config文件放在脚本文件夹中以允许所有匿名用户访问该文件来完成此操作。

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

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