Local IIS in windows 8.1 do not load scripts

Hi.
I have a web application using jquery. is the example of Brady Gaster at TechEd 2014.

well. When I run it from IISExpress it runs ok.
When I run it from IIS site, I got to 404 for all scripts. The scripts are referred to as:
     <script src = "Scripts / jquery-2.1.1.js"> </ script>
     <script src = "scripts / jquery.signalR-2.1.2.js"> </ script>
When I run the application, in F12, I got this:

  Resource interpreted the script but Transferred with MIME type text / plain: "http: //localhost/HitCounter/Scripts/jquery-2.1.1.js".
Default.aspx: 10 Resource interpreted the script but Transferred with MIME type text / plain: "http: //localhost/HitCounter/Scripts/jquery.signalR-2.1.2.js".
Because of this, I got an "$  is not defined"

the default.aspx is :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="HitCounter.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-2.1.1.js"></script>
    <script src="Scripts/jquery.signalR-2.1.2.js"></script>
    <script type="text/javascript">

            $(function () {
                var con = $.hubConnection();
                var hub = con.createHubProxy('hitCounter');
                hub.on('onHitRecorded', function (i) {
                    $('#hitCount').text(i);
                });
                con.start(function () {
                    hub.invoke('recordHit');
                });

            })

    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div id="hitCount" style="font-size: 200px;"></div>
        </div>
    </form>

</body>
</html>

Open in new window

Deraldo SilvaAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
yes, would be better to open another question
your mime type for js extension look fine, maybe you've a file (htaccess) or setting overwritting the mime somewhere
0
 
leakim971PluritechnicianCommented:
1/ do you really have spaces in your paths ? be sure to remove them.

If you don't have spaces :
2/ Add a mime for << js >> extension
http://technet.microsoft.com/en-us/library/cc725608%28v=ws.10%29.aspx

Or another way :
you can use CDN too so speed up page loading if its' published :
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src = "//ajax.aspnetcdn.com/ajax/signalr/jquery.signalr-2.1.0.min.js"> </ script>

Open in new window

0
 
Deraldo SilvaAuthor Commented:
Hi leakim971.
thx for your attention.
there should be no spaces because I simply drag from solution explorer and dropped in <head>

the mime types is .js to application/javascript ( is this correct?)
and the scripts were all brought by nuget.

I just add the CDN and the problem of the undefined is gone. But I got this:

/signalr/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22hitcounter%22%7D%5D&_=1419935615870      HTTP      GET      404      text/html      5,18 KB      < 1 ms      XMLHttpRequest      485      0      0      0      0      70

Can you help me? or I need to open another question?
0
 
Deraldo SilvaAuthor Commented:
ok. but about the CDN solution, is not the good solution. it simply moves the responsability from local to CDN. If I dont have internet access (and sometimes I dont) it not works.
I will reinstall the visual studio because I feel that there is the problem.
I report it here
anyway, you have found what is the problem.

thx for your attention
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.