Link to home
Start Free TrialLog in
Avatar of Deraldo Silva
Deraldo Silva

asked on

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

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
Avatar of Rob
Rob
Flag of Australia image

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>
Avatar of Deraldo Silva
Deraldo Silva

ASKER

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?
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?
I'll check my setup and get back to you
ok. thx.
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:

User generated image
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.
i'm also using windows 8.1 pro! :)

User generated image
Just check that you've got the same options installed:

User generated image
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.
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial