I have saved my website in the wwwroot folder. when i am running it through Visaul Studio 2008 it s running absolutely fine with path
http://localhost:3840/GettingUserId/default.aspx
but through IIS it is unable to resolve the images URL , not even the links to other pages r working (Parser Error). The path is
http://bhukrk106154d/GettingUserId/default.aspx
I am using IIS 5.0.
Is there any IIS setting that I am missing out.I have simply copied the same website folder inside the C:\Inetpub\wwwroot folder
I have seen parser errors becasue the website is trying to use an old framework version.
Go to the default website properties in inetmgr -> go to asp.net tab -> make sure that asp.net version 2.0 is selected.
If you can post the error message it will be usefull too.
Related
I am trying to get my Asp.Net Core 3.1 project running from inside Visual Studio on IIS.
I ran through the steps and it seems to run my Swashbuckle Swagger page, but it hits an error on finding the swagger.json file. When I look at the dev tools, I see I got a 404 when trying to load the swagger.json file. The physical path it is trying to load from is:
C:\inetpub\wwwroot\swagger\v1\swagger.json
But my code is not in inetpub, it is in my development folder. What is even more odd, is I tried this on another machine and it works. So it seems like it should be something to do with how IIS is setup.
I checked my IIS Site settings and the physical path is set to my development folder (not inetpub). And when I hit the "Explore" option in IIS it loads my development folder.
I copied swagger.json into C:\inetpub\wwwroot\swagger\v1\ and it worked (though I then encountered other errors).
Why is IIS trying to use inetpub to find the swagger.json file instead of my development folder?
I was compelled by work to upgrade from Visual Studio 2010 to Visual Studio 2013. In VS 2010, I used the built-in host for viewing .net apps locally and everything worked just fine. Visual Studio 2013 dropped support for the built-in host and compels everyone to use IIS Express.
My trouble is that IIS Express won't serve up "[anything].aspx" no matter where in the folder tree of the project it resides. I created two test files in the root of the project: HelloWorld.html and HelloWorld.aspx (c#) and made both to simply show a page saying "Hi" with the asp.net file showing the current date and time. I then copied these two test files into an arbitrary folder in the project. After building the project (unnecessary, I know), I did a "View in Browser" for all test files. In all cases, the HTML files displayed properly. The aspx files cause a "HTTP 400 Bad Request" / "The webpage cannot be found" error.
I've prowled Stack Overflow and Google and read about some near-misses but ultimately came up empty for this specific problem. I'm hoping this is a simple configuration issue, but the answer so far eludes me. Thanks in advance for your kind assistance!
Edit:
Thanks to Lex Li's suggestion of using the Jexus Manager to see what's going on with the IIS Express configuration, it shows that zero apps are assigned to any of the default application pools. Correspondingly, when clicking on the home of the website in the Jexus Manager, the .Net section of the website is absent.
Edit #2:
The web app is assigned to one of the default IIS Express app pools: Clr4ClassicAppPool.
Sound weird, did you try open the iis express xml applicationhost.config and check there the mime type or the application pool settings?
Windows 10 Professional
IIS 10
Visual Studio 2015 (Running as Administrator)
I want to run from IIS instead of IIS Express as I have an external IP pointing to my machine and I will be receiving messages from an external source. Ultimately I will be using WebAPI but for testing and setting up IIS I am using a simple ASP.NET MVC 5 Web Application.
I created a new ASP.NET MVC 5 Web Application, this is the skeleton Visual Studio 2015 MVC Template, I then ran the application using IIS Express, no issues:
I then went to IIS 10 and created a new website with "localhost" as the binding:
The Physical Path for this new website in IIS is C:\inetpub\wwwroot\AspNetMvcTest:
I then went to the web application properties and switched to IIS. I was asked if I would like to create a new Virtual Directory:
I clicked Yes, if you click No the operation will be canceled and you unsaved Web Application Properties. You have to click Yes to change to Local IIS Property in Visual Studio.
I then was told that IIS "localhost" was mapped to a different folder and would I like to remap:
I clicked Yes. If you click No you will have unsaved Web Application Property changes again and you will not be using Local IIS in Visual Studio.
This is interesting Visual Studio is trying to change the "Virtual Directory" because it will actual change the Physical Path of the IIS Website not add a Virtual Directory. A Virtual Directory is a folder, somewhere outside of the Physical Path of the IIS website that IIS will treat as is part of the Physical Path folder. But I digress.
Now I am told that the "Virtual Directory" was created successfully:
Now we can look at the changes Visual Studio 2015 made to IIS 10:
We have no Virtual Directories on the website bound to localhost:
My Physical Path has been changed by Visual Studio 2015 and it is mapped to my the directory my simple ASP.NET MVC 5 Web Application resides:
So even though Visual Studio 2015 uses the "Virtual Directory" when changing the ASP.NET MVC 5 Web Application Properties, Visual Studio 2015 was only concerned with the Physical Path and that is the only thing it changed in IIS that I can see.
Now for the Internal Server Error 500 Details
I press F5 in Visual Studio 2015 and F12 Tools says there is an Internal Server 500 Error:
If we inspect the request and response in Fiddler, there 500 Error has a Content Length = 0
To try and get more details of the 500 error I have turned Custom Errors off in my Web.Config and also added httpErrors Detailed and PassThrough:
I added "catch all" exceptions handling to Global.asax, no breakpoint hit:
Here is my Call Stack, which is empty and neither breakpoint in screenshot is ever hit:
I added a Console Application to my solution as "Set As Startup Project" and here is my Call Stack proving a break point can be hit:
Here is a screenshot of Event Viewer -> Application, I cleared the Application log, pressed F5 in Visual Studio 2015, refreshed the Application log and it is empty still:
I thought the issue is folder permissions after Visual Studio changed the Physical Path
So I added IIS_IUSRS and gave Full Control even though the Account does not need that high of a level of permission to the Physical Path directory:
My ApplicationPoolIndentity is Framework v4.0 and ApplicationPoolIdentity The ApplicationPoolIdentity is assigned membership of the Users group as well as the IIS_IUSRS group:
I tried adding the specific Application Pool to the Security properties of ASP.NET MVC app Physical Directory, so first I found the process Visual Studio F5 was attached to:
I added "DefaultAppPool" and my IIS Application Pool "IIS APPPOOL\AspNetMvcTest" to the Physical folder Security.
I added index.html to the Web Application Physical Folder and that does not work:
<html>
<head>
</head>
<body>
<h4 style="color: black">hello world</h4>
</body>
</html>
I have moved the IIS website Physical Path to inetpub/wwwroot back to the directory I created when I created the website, I cannot even browse to a simple HTML file, I get the same empty 500 error
So now I am stuck and do not know what else to do.
TL;DR
Before reading the rest of answer it is likely you just need to run aspnet_regiis which you can do from cmd or via a cool tool in Web Platform Installer, if you search "ASP.NET" there is a handy "Execute ASP.NET IIS Registration tool" you can install.
Original Answer:
Thanks for all the help from everyone, first thing I should have done was taken a step back and tested an index.html "Hello World" test file from a IIS Website with c:\inetpub\wwwroot as the Physical Path of the IIS website.
When you first install IIS you have a default website, browse to it and make sure that works. Is a great first start to a new machine. But I just deleted that IIS site after installing IIS
Steps I took for fix:
I uninstalled IIS via Control Panel -> Programs and Features ->
Windows Features.
Restarted my computer
Installed IIS for Windows 10 following this document
Tested IIS by creating a Website, using the DefaultAppPool and then browsing localhost, and that worked (again when you first install IIS you have this website but I deleted it on mine a couple days ago)
I Found that my simple ASP.NET Website still did not work though and it was published to c:\inetpub\wwwroot\AspNetMvcTest so it was not a potential folders permission issue. When browsing, instead of loading my ASP.NET Website IIS redirected to the root c:\inetpub\wwwroot and displayed its IIS Welcome page ("iisstart.htm")
This means I needed to run aspnet_regiis, which I did, via cool tool in Web Platform Installer, if you search "ASP.NET" there is a handy "Execute ASP.NET IIS Registration tool" you can install.
That was it, I was all set, ASP.NET MVC Website started working from IIS immediately upon refreshing my browser (localhost in Location bar).
I think the main problem is that ASP.NET MVC 5 web requires .NET Framework 4.5 at least. From your provided information, the application pool of your web application was using .NET 4.0. It look like you've not registerd ASP.NET 4.5 with your IIS yet.
To register ASP.NET 4.5 with IIS, you could use using Visual Studio's command prompt (as an Administrator), go to the following directory and run the commmand aspnet_regiis.exe -i
C:\Windows\Microsoft.NET\Framework64\v4.5.<version>
After successfully register ASP.NET 4.5 with IIS, change your web application to use .NET 4.5 application pool.
I made a virtual machine on azure to host my asp.net mvc 5 website. I made a directory in iis on the machine and pointed it to my domain. I first put the default iis.html page and went to it. This works.
Now I put all my asp.net mvc code in that folder and I get "500 server error". I don't know why.
I tried to put in my web config
<customErrors mode="Off">
Yet this did nothing. I don't know why it is failing nor how to check. There is nothing special with this website(just controllers and views...not even a database).
I am not sure if I need to install anything more to get it to work. The vm is windows server 2012.
Follow these steps:
Verify installed MVC version in the server (windows\ assembly folder)
Verify application bin folder which should contain appropriate dll(s) (website/ virtual directory maps to a physical folder, bin should be under the root with required binaries)
Also verify MVC views ('Views' folder should be just under the root)
Verify Web.config, which should be updated properly
Application Pool should be running under appropriate .Net version (Run -> inetmgr -> Application Pool -> Advanced Settings -> .Net Framework Version)
I'm trying to deploy an ASP.NET application to localhost using IIS, I've been reading a LOT of tutorials and following them step by step but I just can't seem to make it work...
I created an Application Pool(TestPool) with .NET version 4.0 and gave it every permission to the folder where the application is at.
I then added an application to the Default Web Site and tried to run it at
http://localhost/TestApplication/
But I keep getting:
Any idea what is wrong and how can I solve this?
Versions:
IIS version: 6.2
OS: Windows 8.1
VS 2013 Ultimate: 12.0
VS .NET: 4.6
PS: It's my first attempt at deploying an ASP.NET application so if you need any further information just leave a comment.
EDIT:
It is now running at least thanks to Julian and Marge, but when I run it using VS it has the default view, why isn't it showing when I run it through IIS? When running through IIS it just lists the files:
This error is because your website, in the IIS Server, does not have the Directory Browsing enabled and the default document (default page of the site ex: Default.aspx) configured.
Go to IIS Server IIS > Default Documents and check if the default page of your site is listed, if no, add the page.
Check the related link:
https://support.microsoft.com/en-us/kb/942062
Generally speaking, you do not need to access IIS manager at all to run your webpage on localhost. All what you need to do is right click on the project and then choose properties. In the Web tab you will find Servers section. Make sure the Project Url is something like http://localhost/myproj or simply http://localhost/ then hit Create Virtual Directory. Your webpage should be up by then, and you can access it either in debug mode, or simply by navigating your browser to the Project Url you have chosen.
When you add web application in IIS ex.
That your hostname should be to add in host file which is C:\Windows\System32\drivers\etc"\hosts
ex.
127.0.0.1 test.pln