简体   繁体   English

发布到IIS时未加载外部Javascript文件

[英]External Javascript files not loading when published to IIS

The javascripts works fine on my iis developmental server as well as when I try to access the website using http://localhost:8080 javascripts在我的iis开发服务器上工作正常,当我尝试使用http:// localhost:8080访问网站时

However, it does not load when I replace localhost with my actual ip address so for example it would be http://10.1.65.48:8080 instead of http://localhost:8080 但是,当我用我的实际IP地址替换localhost时它不会加载,例如它将是http://10.1.65.48:8080而不是http:// localhost:8080

I have tried to replace all my URLs using @Url.Content and it still does not work for some reason 我曾尝试使用@ Url.Content替换我的所有网址,但由于某种原因它仍无效

Below are all the external javascript files I tried to load: 以下是我尝试加载的所有外部JavaScript文件:

<script type="text/javascript" src="@Url.Content("~/js/jquery.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/bootstrap.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/jquery.easing.1.3.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/jquery.waypoints.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/jquery.stellar.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/owl.carousel.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/jquery.magnific-popup.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/jquery-migrate-3.0.1.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/popper.min.js")" defer></script>



<script type="text/javascript" src="@Url.Content("~/js/aos.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/jquery.animateNumber.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/bootstrap-datepicker.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/jquery.timepicker.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/scrollax.min.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/google-map.js")" defer></script>

<script type="text/javascript" src="@Url.Content("~/js/main.js")" defer></script>

Check your local IIS site bindings. 检查本地IIS站点绑定。 Right click on the top level site (in my case, it's Default Web Site) and click on Edit Bindings. 右键单击顶级站点(在我的例子中,它是默认Web站点),然后单击Edit Bindings。 Make sure the binding for port 8080 has either the IP address you're using selected or is set to (All Unassigned) and ensure no host name is supplied. 确保端口8080的绑定具有您正在使用的IP地址或设置为(全部未分配)并确保未提供主机名。 When I supplied a host name in my site, it stopped accepting the IP address as a URL, so if I had to guess, that is probably your issue. 当我在我的网站中提供主机名时,它停止接受IP地址作为URL,所以如果我不得不猜测,这可能是你的问题。

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

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