Solved

Resource interpreted as Script but transferred with MIME type text/plain:

Posted on 2014-11-29
11
932 Views
Last Modified: 2014-12-06
Hi.
I have an asp.net angular application using visual studio 2013.
ok. if I run this application with IISExpress, it works fine. but, if I change to IIS, I got the title message above.

the source code of the page looks good, but the angular view is not loaded, so the display is totally empty.

thx in advance
0
Comment
Question by:Deraldo Silva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 43

Expert Comment

by:Rob
ID: 40472058
This is a message from the browser because the MIME type is serving your script file (javascript?) as text.  They should be served as text/javascript (assuming javascript).

When including javascript in your site you should use the type

<script src="..." type="text/javascript"></script>
0
 

Author Comment

by:Deraldo Silva
ID: 40472287
thx Rob for your attention.
I put type=text/javascript and text/css in all scripts and css and I still got the problem.

but why this would be a problem in IIS and not in IISexpress?
0
 
LVL 43

Expert Comment

by:Rob
ID: 40472320
Because you can control how certain extensions can be served with what mime types. Maybe it's a default in the express version but is more flexible in iis?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Expert Comment

by:Rob
ID: 40472321
I'll check my setup and get back to you
0
 

Author Comment

by:Deraldo Silva
ID: 40473356
ok. thx.
0
 
LVL 43

Expert Comment

by:Rob
ID: 40474368
yes, it looks like IIS you can specify the MIME type based on any extension.  Please confirm what you have for your .js and .css extensions as indicated by this screenshot of mine:

Capture.JPG
0
 

Author Comment

by:Deraldo Silva
ID: 40475360
Hi Rob,  I think that you find the problem. But, I am using windows 8.1 pro. I could not find the Mime types in IIS to change. Could you help?

thx in advance.
0
 
LVL 43

Expert Comment

by:Rob
ID: 40475371
i'm also using windows 8.1 pro! :)

Capture.JPG
0
 
LVL 43

Expert Comment

by:Rob
ID: 40475374
Just check that you've got the same options installed:

Clipboard01.jpg
0
 

Author Comment

by:Deraldo Silva
ID: 40483623
Ok. I got the Mime Types. Thx for your help.
Checked. all types are set correctly.

Meanwhile, I created another angular project, from scratch and it works ok. So I think the problem is the solution.

I will recreate my solution.

thx for your help and attention.
0
 
LVL 43

Accepted Solution

by:
Rob earned 500 total points
ID: 40483868
That's good to hear. At least you knew by ruling things out that it was your solution causing the issue.

Glad to have helped.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to copy file 14 45
WPF Select Items 3 25
HTML editor custom button 3 53
Broken .resx file generating errors 18 15
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question