JavaScript 404 Error in IIS - javascript

My team is building a web application using Jquery. We are coding it with Visual Studio Code and running locally using npm's http-server.
I am trying to publish the application on a local IIS server to demo to our management team. I created a new site on IIS (for this topic, I'll call it "MyWebApplication"). I copied our code to the MyWebApplication folder under wwwroot. Our application, however, is not displaying properly from the server--it only displays some of the text, but the menu we created in JavaScript is not showing up.
Looking at the Network tab in the Chrome debugger, I do have an error:
GET http://{iisserver}/scripts/menudata.js?_=1524242509037 404 (Not Found)
The initiator is jquery-3.2.1.min.js:4.
Notice it's looking for the script in the root, http://{iisserver}/scripts/..., not in http://{iisserver}/MyWebApplication/scripts/....
If I expand the scripts folder on the Sources tab of Chrome's debugger, menudata.js and one other script related to our menu are not listed. All other .js files in the folder are.
The menu does show up if I copy my scripts folder from MyWebApplication directly to the wwwroot folder, but I shouldn't have to do that.
Are there any ideas on what I can do to make this script accessible from my IIS?
This is IIS 7.5 on Windows Server 2008 R2.
Edit:
This is a 404 log entry from the IIS log:
2018-04-23 14:29:16 x.x.x.x GET /scripts/menudata.js _=1524493754277 80 - x.x.x.x Mozilla/5.0+(Windows+NT+6.1;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/65.0.3325.181+Safari/537.36 404 0 2 187

Related

Windows IIS wwwroot angular javascript serving up .json files not working

The website with index.html is located here
http://www.example.com/index.html
The is using angular/javascript and i'm trying to serve up fake data with .json files
locally I can do this just fine. Its just very simple javascript ... If i have any CORS issues the browser will tell me in developer tools and i just enable a CORS extension in chrome.
Problem:
Go here : http://www.example.com/index.html#/devices
Reason it seems that no data is showing is the obvious message in that it cannot locate this path
http://www.example.com/api/devices.json
What am I doing wrong?
This is where devices.json is located ... under wwwroot
/example.com/wwwroot/api
IIS is serving 404s (not found) for various reasons, to find out what the problem for your request is, without enabled detailed errors, look at the http log files, locate the request in question and find the http sub-status:
192.168.1.200 GET /devices.json - 80 ... 404 3
the number to the right of the 404 is the sub-status, in this case the 3 means: MIME type restriction. IIS by default is not configured to serve status files with a .json extension. You have add a new MIME Type mapping in IIS on the server or site level.
you may not be owner of http://www.example.com/
your IIS settings are wrong. Try to set ist reachable under http://localhost/ or http://127.0.0.1/
You may also modify your host file under system32 folder but it's not recommended.

Javascript webpage doesn't work on localhost, but OK as file:///

but... file:///home/me/public_html/path/index.html everything works fine...
I'm trying to get a javascript page to run locally. (Using Ubuntu 14.04 and Apache)
When I open the file file:///home/me/public_html/path/to/index.html directory from file manager the webpage javascript runs fine all OK. (by double clicking the index.html file)
When I open it in chrome/firefox using localhost/~me/path/to/index.html only the html is rendered - the javascript doesn't run.
What have I missed or have failed to account for?
The js source files look like this:
<script src="libraries/jquery-1.9.0.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="libraries/prettify/prettify.js"></script>
<script src="libraries/tinycolor.js"></script>
[Solved] it was the subdirectory permissions... they were drwx------and should have been drwxr-xr-x - localhost works now.
Install FireBug in Firefox and view the Console tab. If you found any Network Error, then there is a problem for your Apache to perform requests.
When I faced the same problem, it was the issue of my WAMP stack not able to perform requests due to installation of Bitnami Stacks which were interfering with the Apache of WAMP.

An Apache Web Server Message [duplicate]

This question already exists:
How to run d3 Javascript
Closed 8 years ago.
I am trying to set up d3 Javascript by following this link:
https://github.com/mbostock/d3/wiki . I am currently using Eclipse Juno and Tomcat in Mac 10.5.8. basically I am trying to run a simple Force-Directed graph example that was taken from the following link:
https://gist.github.com/mbostock/4062045
I have been recommended to insert the command below into the Terminal in order to get d3 run:
python -m SimpleHTTPServer 8888 &
With the Web Browser (Firefox in my case), I can insert:
http://localhost:8888/
. When I do this, I get the following message in the browser:
If you can see this, it means that the installation of the Apache web server software
on this system was successful. You may now add content to this directory and replace this page.
Seeing this instead of the website you expected?
This page is here because the site administrator has changed the configuration of this
web server. Please contact the person responsible for maintaining this server with questions.
The Apache Software Foundation, which wrote the web server software this site
administrator is using, has nothing to do with maintaining this site and cannot help resolve configuration issues.
The Apache documentation has been included with this distribution.
You are free to use the image below on an Apache-powered web server. Thanks for using Apache!
What that message means and why am I getting this type of message? How can I get the d3 run so long as I am getting this message?
It looks like that Apache and python are competing for the same port and since you start python in the background mode, it is not reporting the errors correctly.
Try starting python -m SimpleHTTPServer without an argument. It should start on port 8000 and serve the files from the folder it is started from.
The next steps would be to move the html file and the json file in the same folder where you started the server from. Then point your browser to http://localhost:8000/<name-of-your-html-file>.html.

IDEA Failed to load resource

I want to debug my html + javascript site in IDEA and Chrome browser.
When I press 'debug' in console i got:
Failed to load resource file:///C:/js/angular.min.js
As I undestand, I need to set root path of my web site in properties. But where this option?
Such urls (site root-relative, the ones starting with slash) can't be properly resolved when opening file locally (using file:// protocol) - the browser will search for these files in your system root (C:/). You need using remote javascript debug configuration (access your html using the web server url rather than local path) to make this work. See http://wiki.jetbrains.net/intellij/Debugging_JavaScript_with_IntelliJ_IDEA#Remote_debugging for more information on remote javascript debugging in Idea
Note that Idea 12 supports so-called built-in webserver (http://confluence.jetbrains.com/display/WI/built-in+web+server), so you can test your code without installing a web server.
Instead of accessing from local file system try to access your html + javascript application from a web server by putting those appication files in web server.
Install XAMPP or WAMP in your system and copy your application into the htdocs folder to run that application locally.Also edit the files using IDEA from there.So,you can parallely edit using IEDA and run using XAMPP.
http://www.apachefriends.org/f/viewtopic.php?t=14173.

Image and js is not geting displayed from apache tomcat

I have facing strange problem. I have deployed images and js file in Apache Tomcat directrory but it is not showing on page and a warning is coming up:
Resource interpreted as Image but transferred with MIME type text/html: "http://localhost:8084/webApp/img/access.jpg".
Earlier it was working fine but now jquery is also not working and the following error is coming up:
Uncaught ReferenceError: jQuery is not defined
Earlier this error message was appearing in Firefox but Chrome was working fine. But now it is showing the error in Chrome as well.
I have also tried to use the absolute path but no success.
<script src="/webApp/jquery-1.7.2.min.js"></script>
<img src="http://localhost:8084/webApp/img/access.jpg"/>
If you are using tomcat, you should locate the resources at $CATALINA_HOME/webapps/ROOT folder. From there, you might have access to the files.
You can check the access permissions from terminal. If you use unix / linux, locate to the folder:
cd $CATALINA_HOME/webapps/ROOT
And execute the command:
ls -la
This means it can be accessed by everyone, so should be available to everyone accessing to the server by browser
drwxr-x**r-x#** 22 user staff 704 11 jun 01:25 .
You could also try changing the permisions, but your server would be unsure:
sudo chmod a+rx webApp/img/access.jpg
Or go to the webApp folder via cd and execute
sudo chmod -R a+rx .
Deppending on your preferences (the last one means giving permission to all resources on webApp folder, what means givving access to all your projects in server, quite unsure...).
Hope it helps somebody.

Categories

Resources