Any tutorials about how to create an ASP.NET MVC 2 website and run it against Local IIS Web Server (not use Cassini) - asp.net-mvc

does anyone have any good links/tutorials about how to create a simple ASP.NET MVC website, and have it run against a Local IIS7 Web Server, instead of the default Visual Studio Development Server (aka Cassini).
Yes, i tried google, but i fail at getting some good keywords, etc.
Cheers :)

Here are my steps:
In IIS, Sites -> Add Web Site...
Fill in the name, whatever you want.
Set the physical path where your app is located.
In the Host Name option, type for example local.test.com
Hit OK
Then I update the hosts file located in $windir$\System32\drivers\etc
Adding the line
127.0.0.1 local.test.com
Don´t forget changing in the application pool of the created website the framework version.
I´m sure there must be other ways, I just follow this steps every time I want to create a new site in my local IIS and it works.
Good luck!

Related

How to debug an ASPNET Core application in a subfolder

I have a ASPNET Core application that works fine on my machine with URL https://localhost:5001/, but not on the client's server, where the application's URL is https://example.com/subfolder/.
The problem seems to be an error in a redirect on one of the pages, where a user is sent to /something rather than /subfolder/something. I'm using relative URL's only. In the rest of the application, redirects work fine.
I was wondering if it is possible to debug the application in Visual Studio and have it run in a subfolder, preferably using Kestrel, but IIS Express might be an option too.
Update after comments While adding specifics about the problem, I found out that I was looking at it from the wrong angle. The actual problem seems to be that the application is started as https://example.com/subfolder (no trailing slash). Redirecting to ./something (or just something) will result in https://example.com/something.
(My real question therefore would be: If https://example.com/subfolder is opened, how can I redirect to https://example.com/subfolder/? I'll first try to fix this myself, maybe it should be configured in the webserver. In the meantime, I'd still like to know if subfolders can be used in debugging)
In development, it seems you can't debug your program in subfolder.
I don't recommand you to spend a lot of time to serach how to do that, and I also suggest you use IIS. Because in IIS, it supports Virtual Application, and I think it is you want.
Steps:
create a main website, and create a virtual application.
choose the project folder as Physical Path, mainsite and virtualapplication.
open vs2019 as administrator, maybe you need open it twice,and one for main site and another for virtual application.
then you can attach to a running process on your local machine.
you can start your two webapp in one port, and you can debug them.

Hosting Web Application ASP.NET MVC on Local Machine Without Internet

I built my first MVC ASP.Net web Application and host it on IIS on my machine and it works fine.Now i want to host it on Client Computer without internet. Please guide my how can i perform this.
Do i Need to Install Visual Studio and SQL server on my Client Computer as well and then publish it there, or
I can simply copy the published Folder and copy to client Machine which i don't know how.
Moreover how would i manage my DB on Client Computer and what necessary changes should i Make in Web.config file to work it properly.
Thank u.
Try following Steps.
1 ) Create a folder in C:\inetpub\YourFolder
2 ) Place your Published Web Application here.
3 ) Open Internet Information Service.
4 ) Sites -> Add Website
5 ) Give a site name
6 ) Set above folder path as at Physical Path Option
7 ) Select a Port no as example 88
8 ) Press OK
Image
9 ) Run in browser
while running, it may show an error, that Login failed for IIS APPPOOL\my-website-name , to clear this problem do the following steps more :
Open MSSQL Server.
Open security folder -> Logins folder then right click, and select New Login from option.
Add the name as shown in image.
Select user mapping tab, then select database file from the list. Then select the check box for db_owner and public.
Run in browser.
For more details : Asp.Net MVC website hosting in localhost
You can definitely self host a .NET web application using OWIN. Unfortunately documentation and information about it is vague and confusing at best. The fact that you're using MVC makes it somewhat easier as you may be able to directly use the self-host packages from Nuget for self hosting Web API. There may be similar packages for MVC.
I don't have recent experience but a Nuget search for "MVC Self Host" should yield some results.
Below is a link with an example. But the term you are looking for is definitely "self host". It can be done via a console window or (more complex) a windows service. It will likely use some form of OWIN but you can probably find some startup code to copy and paste into your project, usually in the form of a Startup.cs file.
http://www.c-sharpcorner.com/UploadFile/4b0136/working-with-owin-hosting-and-self-hosting-in-Asp-Net/

How do you deploy a MVC4 .net app to production WITHOUT Web Deploy

I'm trying to deploy one of the default template apps that VS2012 generates for MVC4 to a production server (not on Azure).
It turns out that I'm not smart enough to figure out how to get Web Deploy working. After spending an hour on diagnosing different 404s, 403s, and 401s, I am ready to either ditch Web Deploy altogether, or start my project using PHP instead.
Can I just copy and paste my files and put them somewhere?
I'm fine with manually updating the database schema.
Anything else that needs to be updated?
You can publish directly to "File System" via "Publish" menu in VS (choose folder on production server). Then create WebApp on IIS with this folder (on the server) choose ApplicationPool 4.0 open port for your application if needed and start it.
What in the world makes you even think you need to use web deploy? You do realize that the web publishing wizard has several options to choose from, including FTP, file system, etc... I don't see how you could miss these.

how publish and view mvc website basic steps

First time I am trying to publish an mvc website. So far I have published it to a local folder and using IIS I have made the folder a virtual folder. How do I run the website from my browser and how to start it with Account/LogOn?
Here is the link of Video tutorial release by ScottGu regarding MVC deployment and study hope this will help you
http://weblogs.asp.net/scottgu/archive/2011/05/15/great-free-video-training-on-asp-net-web-forms-and-asp-net-mvc.aspx
There are many articles and tutorials out there about deploying ASP.NET MVC applications. Once IIS is configured you simply point your browser to http://localhost/NameOfTheApp/Home/Index and you should be ready to go.
First which version is there on remote server. For your account logon i am assuming that you are using default membership provider. I normally include membership provider table in my database. If you are running on IIS 6.0 then you have to made some changes as mentioned by Haacked on his blog. While publishing make sure that mvc dll in made copy local and is there on your bin folder on remote site. First publish the site on local and if it is running properly upload it on remote server set the connectionstring as told by your hosting provider

Best practices for deploying an MVC application on IIS7

I'm not a web admin, and I'm new to IIS. So, I'm looking for advice.
My MVC application (e.g. fooapp) is the default application for my site (e.g. foo.bar). I used IIS Manager to add the site to IIS7. When I import the application, IIS Manager wants to put it in it's own directory (/foo), and tells me I shouldn't put it in the base (site) directory. This means that to get to my default MVC view, I have to enter the URL http://foo.bar/fooapp/. Needless to say, I want to get there via http://foo.bar/
I see 2 possible solutions:
Add a default page to the site directory that redirects to the MVC app.
Ignore the IIS admonition and load the app into the site directory.
My IIS7 knowledge is limited. I have played around with some options (such as HTTP Redirect). Since nothing changed, I obviously don't understand what I'm doing.
Anyway, if there are some considered "best practices" and/or other suggestions, please let me know.
Tbh, I'm not sure why the IIS manager is trying to convince you to add it as a sub app.. Maybe you just didn't do it right >_>
I've got a couple servers running with IIS7/7.5 and they have apps running in the root of the website.. No problem there :)
You might want to create a new website in IIS (right click on websites, choose "Add Web Site"), point the "Physical Path" directly to the folder your website's stored in, and set the Host name to whatever host you use (foo.bar ? :) )
This should work just fine )
In terms of deployment, if you use VS2010 I'd really recomment looking at Web Deploy.. It's a new addon written for IIS7, and allows one-click publish to IIS directly from VS2010. I'm using it on my site and it works flawlessly :)
Check out Scott Hansellman's talk about it, or check it out in the IIS website

Resources