- From the Build menu choose Publish Web Site:
- You can either accept the default location or change it to something else:
Make note of the location chosen as you will need it shortly.
- Now let’s configure the website in IIS 7. Launch IIS manager from Control Panel | Administrative Tools | Internet Information Services (IIS) Manager:
Hint: IIS Manager is the configuration tool for IIS and you’ll be jumping into it often. You can use the Run dialog for faster access via the Windows + R then typing “inetmgr”:
- Expand the tree control on the left, right-click on Default Web Site then right click and choose Add Application:
- Type in an Alias name that will be used as the website name when browsing, Select the ASP.NET v4.0 Application pool and choose the same Physical path where you just published the website to previously. You should click the Test Settings button to verify that Authentication and Authorization are configured correctly:
- If you received the above Authorization error it means that IIS does not have permission to access the folder where you published the website to. If this occurs, click Close then OK to complete the creation of the application. Back in the tree view control right-click on Edit Permissions to grant the IIS web server permission to the publish folder:
- On the Security tab choose Edit, then Add, then Advanced, and finally Find Now:
- From the list of users and groups use Control + click to select the follow three:
- IIS_IUSRS
- IUSR
- NETWORK SERVICE
- IIS_IUSRS
- When testing from within Visual Studio we are running under the permissions of ourselves – the account we signed into Windows with. When browsing against IIS, it is IIS that is connecting to the database. Since the IIS web server will be acting as a proxy for the user when accessing the database, you must grant the IIS user permission to the database. Using SQL Server Management Studio, execute the following T-SQL statements:
CREATE LOGIN [IIS APPPOOL\ASP.NET v4.0] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english] GO CREATE USER [AdventureWorksUser] FOR LOGIN [IIS APPPOOL\ASP.NET v4.0] GO EXEC sp_addrolemember 'db_datareader', 'AdventureWorksUser' GO
- Finally right-click on the website again, choose Browse:
- Sit back and enjoy the fruits of your hard labor:
Seeking a pragmatic approach to software development blending proven designs with real-world constraints.
Monday, December 20, 2010
How To Build a 2-Tier ASP.NET 4.0 Web Site–Part 3
Now that IIS 7.5 is installed on Windows 7 let’s move on to deploying the website to IIS and testing it there.
Labels:
ASP.NET 4.0,
IIS 7.5,
Tutorial,
VisualStudio,
Win7
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.