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.
问题:
回答1:
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 fordb_owner
andpublic
.Run in browser.
For more details : Asp.Net MVC website hosting in localhost
回答2:
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/