简体   繁体   中英

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

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

I have tried to replace all my URLs using @Url.Content and it still does not work for some reason

Below are all the external javascript files I tried to load:

<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. Right click on the top level site (in my case, it's Default Web Site) and click on 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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