How to configure Asp.Net Web Application with IIS - asp.net

I am using Asp.Net Standard version 4.7 with MVC and attempting to deploy to IIS Express. I am facing several issues in the configuration and cant seem to find straight forward documentation for asp.Net standard. I added a website named localHost aside from Default Website in IIS. I am facing 2 issues.
When I click browse from IIS, it navigates http://localhost/Views/Home/Index.cshtml I get a 404 error.
Server Error in '/' Application. The resource cannot be found
When Debugging From Visual studio 2019 I get
Process with Id of xxxx cant be found
.
Description: HTTP 404.
I am thinking there some port configuration issue but I am unclear on how to configure.
I attached screenshots of my configuration settings.

Please follow Microsoft guideline.
You are trying to access wrong Url. Try below url to access:
http://localhost:8080/Home/Index

Maybe you are misunderstand MVC, you should visit a restful path in mvc instead of cshtml, just like this: http://localhost:8080/Home/Index -> to find /Views/Home/Index.cshtml in you solution.

To host the site .net application you need to publish it and use that publish folder as site folder path in iis.
1)open visual studio, select your project.
2)right-click on your project and choose publish:
3)in publish target select folder and create a new folder in c or another drive where can you access the folder.
4)click on the publish
5)open iis and create a new site
6)choose the folder path and site binding
7)browser your site.
Note:
Assign iis_iusrs and iusr full permission to the site folder. you need to set the physical path credential with your Gmail account.

Related

HTTP Error 403.14 - The Web server is configured to not list the contents of this directory. in .NET core 3.1

I have project which don't have .sln file as well. I am trying to run but facing error.
I am trying to resolve this issue by going into IIS manager. IIS manager don't have list of sites and unable to add site.
Please give me solution.
Thanks
You are most likely using IIS Express while launching the program and that is why you don't see a website in IIS.
I think you want to enable directory browsing, so look here:
How to enable Directory browsing by default on IIS Express
Just a small side note: by careful with directory browsing on public websites as it can be a huge security risk.

aspx pages downloads after hosting in IIS?

We hosted the website in IIS. When we test the home page of our site IIS suddenly offering to download the aspx page instead of rendering .
We hosted the website in IIS 7.0. Website developed with DotnetFramework 4.0.
Please help me in identify the bottom of the problem.
You'll need to drop into the command prompt and navigate to the folder;
c:\windows\microsoft.NET\Framework\V4.0.30319\
and type the command aspnet_regiis -i
this will configure the IIS server to correctly process the aspx files - not sure why it would work previously and then suddenly stop working, have you used this explicit version of .NET on this server before?
You have to configure it once again. Before that, follow some steps mentioned below:
You have to build the web application within your Visual Studio.
After successful build,you have to publish the application and save that published copy to specific folder say 'MyPublieshedApp'.
Start IIS and add new website. You have to point the folder which contains the published content of your application. In this case the folder should be 'MyPublishedApp'.
Set the application pool and set the framework version to ASP.NET 4.0.
5.Then browse one of the page after configuring it into the IIS.
May be this will help you.

asp.net web forms -- 404 on publish

I'm having some issues getting my project to publish to a server for work.
we don't have a folder shared to the project directory or a FTP server setup so in order to publish I have to publish it locally, remote into the server, then copy/paste the project files into the desired location.
I have done this plenty of times before with no issues but for some reason it is not working for me now. Every time i go to the site I get a HTTP 404
One weird thing that I noticed is in IIS when i click on 'basic settings' the virtual path is set as /portalDEV/Apps, alias is UA, and physical path is D:\websites\portalDEV\Apps\UA, When i click on 'test settings' i get an error saying invalid application path.
Any ideas? Please let me know if you need anymore information.
On your server IIS you must create virtual path who link physical path of your application.
You set an alias
You set the directory of your application
In the end of treatment your check the framework version section

Changing "Project Url" causes ASP.Net Web app to not be debuggable

I have an ASP.NET Web Application project that I am using to host a WCF Data Services (OData) project.
I went and changed the url from:
http://localhost/MyProject
to
http://localhost/v1/MyProject
after I did that I created a Virtual Directory for the new project URL.
Now when I run I get this error:
Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
I clicked help but it was no help (was IIS 6 level instructions, I have IIS 7). I did some googling and it was all fairly generic responses.
How can I get this working again? (Aside from revert to my old Url. Reverting works but I changed it for a very good reason.)
Your virtual directory need to point to the same scr directory you were originally debugging against.
Also, make sure the virtual directory is configured for Windows Authentication, which is required for debugging.
I had to go to my website in IIS and add a folder under it called v1. After I did that it all worked perfectly.

IIS ASP.NET MVC3 doesn't show my website

So I've set up IIS 7.5 to host my ASP.NET MVC website on my own local machine, but when I surf to http://localhost/ I just get this:
Welcome to ASP.NET MVC!
To learn more about ASP.NET MVC visit
http://asp.net/mvc.
A very basic HTML page with only this on it. No CSS or anything.
I haven't used IIS before, so I don't know what settings I need to change in order for this to work, but this is what I've done:
Added a new Site "MySite"
Set the Physical path to the root folder of my asp.net project
Tested the settings (everything OK)
Edited the "MySite" Application Pool and set it to .NET framework version v4.0.30319
What else do I need to do to make my website display? Thanks.
EDIT: please read this
I'll give a step-by-step walkthrough of what exactly I do:
1) I create a new ASP.NET MVC3 Razor web project. I don't do anyting but save and build the project.
2) I open IIS Manager
3) I go to Sites -> Add Web Site
4) I fill in following data:
Site Name: MyWebSite
Application Pool: MyWebSite
Physical Path: Visual Studio 2010\Projects\MyOwnProject\MyOwnProject (Project root folder)
Connect as: My PC's login and password. Test Settings is succesful
I leave the rest of the settings as it is and press OK
5) I go the Application Pools and edit the basic settings of MyWebSite to change the .NET framework to the latest version (v4.0.30319)
6) I select MyWebSite and click Browse *:80 (http) to go the web site. It opens up Chrome and I see the following page:
<h2>Welcome to ASP.NET MVC!</h2>
<p>
To learn more about ASP.NET MVC visit http://asp.net/mvc.
</p>
That's it. Nothing more. What am I missing here?
That looks like it is working (at least that's an MVC page it is displaying.) Maybe you need to alter your default route in Global.asax.cs to hit a different controller?
Do you have a Layout.cshtml in your shared folder and is your ViewStart pointing to it?
Edit:
I do remember having an issue like this at one point. I think it has to do with static resources pointing to the root which by default will be pointing to another App in IIS. I'm not sure if this is exactly the issue but what I do is setup an address in my host file for each application. For me the host file is :
C:\Windows\System32\drivers\etc\hosts
You have to run notepad or something as Administrator to edit it and add the following line:
127.0.0.1 MySite
This will allow you to simply navigate to http://mysite without any conflicts. Just double check your IIS setting so that the hostfile address point to the right physical path.
It seems I've fixed it, I don't know how or why this works. But this is what I've done:
In Visual Studio, I went to the Properties of my project. There, in the Web tab, I selected "Use local IIS Web Server", filled in "http://localhost/MyWebSite" and hit "Create Virtual Folder".
Save and build the project and suddenly it worked. However, I am not able to debug my project from Visual Studio now. But when I change the Web configuration back to "Use Visual Studio Development Server" it still works and I can debug again...
Doesn't make too much sense because you should be able to debug from IIS right?

Resources