user7851085
user7851085

Reputation:

Hosting an asp.net website in my computer

I have an app I am modifying for a client. The app is in asp.net. I have read that I can deploy the app in three ways:

I would like to go with xCopy method. I have not installed visual studio but have SQL server installed.

Coming from a PHP background, is IIS just like apache where I can copy my files inside a directory in IIS and launch the app in a web browser or is there an extra step that required to be able to run the asp.net web app?

Upvotes: 1

Views: 1745

Answers (1)

user1773603
user1773603

Reputation:

Here is a complete guide to:

  • Install IIS in windows
  • Install SQL Server Express
  • Publish to IIS in Visual Studio
  • Finally, test in the test environment

Note: There is no need to install IIS, just enable its some settings. And you have to install SQL Server and Visual Studio.

Edit:

  • Install IIS

    • Open Control Panel, Programs and Features, Turn Windows features on or off.

    • Make sure that ASP.NET 4.5 is selected under Internet Information Services -> World Wide Web Services -> Application Development Features.

    • Set ASP.Net Framework from v2.0 to v4.0: Press Windows + R and type "inetmgr" hit enter.

    • In the Application Pools pane under connections, click DefaultAppPool, and then in the Actions pane click Basic Settings.

    • In the Edit Application Pool dialog box, change .NET Framework version to .NET Framework v4.0.30319 and click OK.

  • Install SQL Server Express

    • Download it from here either x64 and x86 based.

    • After downloading SQL Server run the setup and click New SQL Server stand-alone installation. In the installation wizard accept the default settings.

  • Publish to IIS in Visual Studio

    • Run Visual Studio as Administrator by Right - Click on VS icon.

    • Right - Click on your project select Publish, in Publish Web create new Profile.

    • In Connection tab enter localhost -> Service URL, Default Web Site/yourProjectName -> Site/application, http://localhost/yourProjectName -> Destination URL

    • In Settings tab check Exclude files from the App_Data folder.

    • enter Remote connection string that you have use to connect with SQL Server database.

    • Check Update database and click Configure database updates add sql script Grant.sql that you will run in SQL Server which is like:

IF NOT EXISTS (SELECT name FROM sys.server_principals WHERE name = 'IIS APPPOOL\DefaultAppPool')
BEGIN
    CREATE LOGIN [IIS APPPOOL\DefaultAppPool] 
      FROM WINDOWS WITH DEFAULT_DATABASE=[master], 
      DEFAULT_LANGUAGE=[us_english]
END
GO
CREATE USER [ContosoUniversityUser] 
  FOR LOGIN [IIS APPPOOL\DefaultAppPool]
GO
EXEC sp_addrolemember 'db_owner', 'yourProjectName'
GO

  • Finally click on Publish.

  • Test in Environment

    Check that your project files have exits in wwwroot folder at C:\inetpub\wwwroot\yourProjectName. Run your project index.aspx file and test it.

Upvotes: 2

Related Questions