.asp Extension Configuration in IIS - iis

I have installed IIS, and then browsed to a URL representing a file containing:
<!DOCTYPE html>
<html>
<body>
<%
response.write("hello world ");
%>
</body>
</html>
but got this error:
Error Summary
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
What kind of extension configuration have I missed? There is also short summary:
It is possible that a handler mapping is missing. By default, the static file handler processes all
content. The feature you are trying to use may not be installed. The appropriate MIME map is not
enabled for the Web site or application. (Warning: Do not create a MIME map for content that users
should not download, such as .ASPX pages or .config files.) If ASP.NET is not installed.

You need to install ASP support into IIS.
Under Windows 7 (and, as I understand it, Vista): Control Panel | Programs and Features | Turn Windows features on or off | select ASP (under IIS, World Wide Web Services | Application Development Features).

Related

IIS - Not serving my JS and CSS files over the internet

I have got my website to work localhost on Windows Server 2019 dedicated IIS 10, but I am trying to reach my site on the internet using my IP address so like this:
http://142.11.195.158/ but my CSS file and JS files are not loading.
and is that why i cant load my CSS and JS files because I am using the IP address to view the website remotely?
I have allowed anonymous access to enabled to my Apppool aswel. my mime types are setup of having these files.
Where am i going wrong?
In my index page im loading the images as so:
<img src="img/service-icon/diamond.png" alt="Service 1">
and
<img class="slide-img" src="~/images/image3.png" alt="Slide 3" />
Im using MVC core 3.1
The files are pointing to here external files:
https://142.11.195.158/css/youtube.css
In my root folder in IIS the css and js files are inside wwwroot, this is how the website got published from visual studio, so my root is wwwroot and inside here is the published css an js files inside wwwroot
--wwwroot (website)
--wwwroot
css
js
Static files is ticked also when i installed Web Server or IIS
I think for the moment, you need to remove this line:
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

HTTP Error 404.3 - Not Found in Azure with asp.net MVC and WebAPI core 2.1

Hi All I am getting below error, There is no publishing error. and also checked by deploying a MVC core 2.1 application which is generated by VS 2017 and the application also contains the font file. In that it does not produce any error and runs fine. But the project its giving below exception and the details are...
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Most likely causes:
It is possible that a handler mapping is missing. By default, the static file handler processes all content.
The feature you are trying to use may not be installed.
The appropriate MIME map is not enabled for the Web site or application. (Warning: Do not create a MIME map for content that users should not download, such as .ASPX pages or .config files.)
If ASP.NET is not installed.
Things you can try:
In system.webServer/handlers:
Ensure that the expected handler for the current page is mapped.
Pay extra attention to preconditions (for example, runtimeVersion, pipelineMode, bitness) and compare them to the settings for your application pool.
Pay extra attention to typographical errors in the expected handler line.
Please verify that the feature you are trying to use is installed.
Verify that the MIME map is enabled or add the MIME map for the Web site using the command-line tool appcmd.exe.
To set a MIME type, use the following syntax: %SystemRoot%\windows\system32\inetsrv\appcmd set config /section:staticContent /+[fileExtension='string',mimeType='string']
The variable fileExtension string is the file name extension and the variable mimeType string is the file type description.
For example, to add a MIME map for a file which has the extension ".xyz": appcmd set config /section:staticContent /+[fileExtension='.xyz',mimeType='text/plain']
Warning: Ensure that this MIME mapping is needed for your Web server before adding it to the list. Configuration files such as .CONFIG or dynamic scripting pages such as .ASP or .ASPX, should not be downloaded directly and should always be processed through a handler. Other files such as database files or those used to store configuration, like .XML or .MDF, are sometimes used to store configuration information. Determine if clients can download these file types before enabling them.
Install ASP.NET.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module StaticFileModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x80070032
Requested URL https://~1GpsLearning:80/Content/fonts/glyphicons-halflings-regular.woff
Physical Path D:\Program Files (x86)\SiteExtensions\Kudu\79.20129.3767\Content\fonts\glyphicons-halflings-regular.woff
Logon Method Anonymous
Logon User Anonymous
It was the issue of up-gradation from 2.0 to 2.1, SO I created a fresh application in 2.1 core and just implemented my other code as it is and every thing worked fine and is running on azure very smoothly.

IIS paths ignoring application folder

I lack the know-how with IIS and IIS manager to even have the proper google terms here, so I hope you'll keep that in mind if you're tempted to click that downvote button.
Thanks.
Okay, so I have an angular application that I just moved over to an an IIS server after developing it locally, without using IIS.
The IIS-based copy of the application works, in that it will serve index.html as expected. Unfortunately, links to external files (.ccs, .js, etc) are all broken.
The application lives in this folder:
\\iis.dev.local\c$\inetpub\wwwroot\the-application
And it's .css file lives here:
\\iis.dev.local\c$\inetpub\wwwroot\the-application\css\main.css
As originally written, the link to that .css file, which we'll call "link 1":
<link rel="stylesheet" href="/css/main.css">
Which worked fine in development, but doesn't work on IIS.
However, this does work, which we'll call "link 2":
<link rel="stylesheet" href="/the-application/css/main.css">
See how I had to add the folder that the application itself sits in? Which is strange, because relative to index.html, "link 1" should be correct--but it isn't.
How can I convince my application that its base url should be the folder it's sitting in, and not one level above?
Random partial guesses and/or useful information?
1) The application sits in the default application pool.
2) Something, something web.config?
EDIT: screwed up some paths.
Try using the <base> HTML Element to set the root.
https://www.tutorialspoint.com/html/html_base_tag.htm
In your example it would be:
<base href="https://www.the-application.com" />
Then the rest should flow, with relative paths.
When developing on your local machine you are most likely running under a Virtual Folder under the DEFAULT website.
When you move to a server you are now running at the ROOT of the site.
Options:
Create a new site on your DEV Machine at the Root of IIS. Then use this path to test your site. When you migrate to production the paths will be the same.
Create a variable with the correct path, and if running LOCALHOST (in the url) use one path, else the other. Use JavaScript to add the link to your HTML (Something I have done with a JavaScript site under IIS for Cordova Development).
Change your page extension from .html to .aspx (yeah I know who wants to do that...) then change your links as follows. (I had to remove the starting < and ending /> in the code below, it would not format in the post)
link rel="Stylesheet" type="text/css" href="<%= ResolveUrl("~/css/main.css") %>"
When you browse your source afterward you will see... (or when you navigate to sub-pages it will put the correct relative path in place for you)
<link rel="Stylesheet" type="text/css" href="css/main.css"/>

Classic ASP on IIS delivers Error Document instead of content on HTTP 410 Gone

I’ve got a Classic ASP application running on IIS (6/7) servers. When a page is requested that won’t be accessible any longer, I want to send a Response.Status = "410 Gone" but still deliver some sort of ErrorDocument. It seems that browsers halt retrieving as soon as they get a 410.
Except for IE, all browsers display the same “The page you requested was removed”, so I guess it’s a server setting. In .NET, there seems to be TrySkipIisCustomErrors, but for Classic ASP, I’m actually quite confident it’s anywhere in the Error Pages feature in IIS Manager.
Can I tell my IIS to still deliver content, even when the actual URI is gone?
In your web application’s root directory, you have to add an attribute in the web.config file:
<system.webServer>
<httpErrors existingResponse="PassThrough">
…
</httpErrors>
<system.webServer>
With existingResponse set to PassThrough, the response will be delivered if an existing response exists. There’s a nice article on HTTP Errors at www.iis.net.
There doesn’t need to be an <error> element, especially none on status code 410 (but of course you may add one).
You could place a classic ASP page there that delivers the content and HTTP Status Code you want.
I tested this on IIS 7.5 with following code:
<% Response.Status = "410 Gone" %>
<html>
<body>
<h1>this is my content</h1>
</body>
</html>
Firefox shows the content as is, not a generic error page.
Update:
You will have to disable custom errors for this to work. You can do this by adding following line to your web.config (into section configuration/system.web):
<customErrors mode="Off" />
Otherwise, the default error page overrules your output. Classic ASP really doesn't seem to have anything like TrySkipIisCustomErrors.

CSHTML Page getting rendered as a static Page

I made a Website using Web Matrix.
I added that site to IIS web server under websites in Windows 8.
I added MIME Type for .cshtml file as text/html in IIS web server?
Razor code is not getting executed and getting rendered as plain text in browser.
Am I getting error because of wrong MIME type ?
How should I resolve this ?
Yes, that's exactly why it's not showing correctly. The MIME type shouldn't be added, that comes directly from the Handler Mappings section, so just delete the MIME type you added and it should work fine.

Resources