Setup IIS in localhost as web development server - asp.net

How can I setup IIS 5.1 in Visual Studio 2008 as my web development server? I'm using Win XP, and I was using Cassini, but I want to give a tray to IIS instead of.

Go into Control Panel -> add remove programs -> enable / disable windows features, find IIS and install it.
Go to Start -> Accessories -> Administrative tools -> IIS Manager
Right click websites, add a new website, point the home directory to the root of your site.
Open up localhost
????
Profit!
You might have to attach Visual Studio to the ASP.NET worker process to debug.

It's in the web project's property pages, under Web->Servers->"Use local IIS web server"

To attach Visual Studio to the ASP.NET worker proccess to debug go to menu Tools\Attach to Proccess or press CTRL + ALT + P and select aspnet_wp.exe or w3wp.exe.
More information here.

To develop Website using Visual developer 2008 with IIS instead of "ASP.NET Development Server", In the new website window under "Location" click on "Browse" to see the different Server options including IIS Server. User can select the server as IIS server instead of "File System", then the "Location" option will be "HTTP" instead of "File System".
In Visual developer 2008 under Properties->Start Option->Server->"Use local IIS server" option is not shown, Even though IIS server was installed and configured successfully. the only options shown are "use default server" and " Use custom server with base URL".
So in Visual developer 2008 to run on IIS server(If IIS server is installed), Need do the following:
New Website -> Under Locations Click on "Browse" -> Click on "Local IIS" and then select the "IIS Virtual Directory"(IIS vitual Directory which is directory created by the user while configuring IIS server) -> Open
While Running/debugging, the server which you selected while creating the website, the same server will used to open the website, that is while creating the website if you selected "IIS Server" then the website will be opened though IIS server.
One more thing is, while installing Visual developer 2008 and IIS server, If you installed IIS server after installing Visual studio then you need to do the following before creating new website:
Run ->cmd press enter (then enter the following Command)-> C:\WINDOWS\Microsoft.NET\Framework\Version# aspnet_regiis -i press Enter then you get message after 3 seconds "ASP.net was installed successfully".
(*Version# will be v2.0.50727 in most cases)
Before everthing make sure you have installed and configured IIS server. To know how to install and configure IIS server check the following Link:
http://chalaki.com/install-iis6-windows-xp-professional-sp3-setup-run-csharp-cgi/425/
Hope this helps.

Related

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:
xCopy Deployment
Precompiled Deployment
Web Setup Project
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?
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.

Asp.Net Application was not working when we deployed in IIS 8.0

In Windows Server 2012 created simple Asp.Net using Visual studio 2012. Then I have deployed it in IIS 8.0. In IIS manger browse the deployed simple Asp.Net application, it was working fine when the sample Visual studio project is open. After closing the Visual studio project then we browse it from IIS manager option, the application was not working.
Please provide the solution if you know about it.
Note: The page can't be displayed error be occur.
Few Things you need to check for hosting in IIS.
Application Pool frameWork : Ensure the correct framwork is installed V(4.0.30319).
Navigate to C:\Windows\Microsoft.NET\Framework\v4.0.30319 directory
Open command window here (CTRL + SHIFT + rightClick)
Type in the Command prompt aspnet_regiis -i to register the latest framework.
Physical path Security/permission :
IIS -> (select your VD) -> Manage Application-> Advanced settings -> Physical path credential -> Choose connect as Specific user -> provide the systems username and password.
Add read/write permission for IIS_IUSERS object

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path

net project in vs2010 i have a db and table inside the app_data folder, i have created a deployment package and have imported the package into an iis server that is installed on my local mechine.
now i get this error message while trying to preform an insertion.
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed
the connection string is:
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\survey.mdf;Integrated Security=True;User Instance=True
when running it inside VS2010 it`s working fine.
how can i solve this probelm ?
Remove the User Instance=True. You don't need RANU instances. Next, make sure the SQL Server Express service account had the proper needed rights on your app_data:
cacls <path\app_data> /E /T /G SQLServerMSSQLUser$<ComputerName>$SQLEXPRESS:F
This article helped solved this issue: http://support.microsoft.com/kb/2002980
Edit From the MSDN article (in case the link disappears):
Resolution for Windows 7 and Windows Server 2008 R2
For all web applications running under IIS 7.5, regardless of their
project type, carry out the following steps:
Run the Internet Information Services (IIS) Manager tool. This tool can be accessed either from the Administrative start menu, or by
typing "inetmgr" in the Windows Start-->Search textbox and selecting
the inetmgr tool.
In the left-hand pane of the IIS Manager tool expand the machine node. Click on the "Application Pools" node so that the application
pools display in the main window of the management tool.
If you are troubleshooting an ASP.NET 2.0/3.0/3.5 application select the "DefaultAppPool" application pool. For ASP.NET v4 select
the "ASP.NET v4.0" application pool.
Right-click on the selected application pool and choose "Advanced Settings"
In the "Advanced Settings" dialog box find the category called "Process Model". The first row in the category will be the "Identity"
row.
Click on the "Identity" row and then click on the small button that shows on the right-hand side of the value cell. The button
displays the text "…"
A dialog box called "Application Pool Identity" will popup. Within that dialog box there are two radio buttons. Make sure the
first radio button titled "Built-in Account" is selected.
In the dropdown box below the radio button choose "Network Service" for the identity.
Click "Ok" to close out the "Application Pool Identity" dialog box.
Click "Ok" to close out the "Advanced Settings" dialog box.
At this point the changes to the application pool identity will have been saved to IIS 7.5's configuration store.
Resolution for Web Application Projects and Websites
For web application projects (WAP) and websites located in a user's
Documents Folder hosted under any version of IIS running as NETWORK
SERVICE, carry out the following steps:
First confirm that IIS has been configured to run as NETWORK SERVICE. This is the default on IIS6 and IIS7. However if you are
running on Windows 7 or Window Server 2008 R2 you will first need to
follow the steps above in "Resolution for Windows 7 and Windows Server
2008 R2" to make IIS application pools run as NETWORK SERVICE.
From a command prompt, type net stop iisadmin /y . This will cause any running ASP.NET WAP applications to shutdown.
Exit out of all running Visual Studio instances.
NETWORK SERVICE must be granted Read permission to the top-level Visual Studio folder located in your user's Documents folder. The
Visual Studio folder will have different names depending on the
version: "Visual Studio 2005", "Visual Studio 2008", or "Visual
Studio 2010".
NETWORK SERVICE must be granted both read and write permissions to your project's top-level project folder. For example if your WAP
project is called "MyCustomWebProject", then the folder
"Documents\Visual Studio 20xx\Projects\MyCustomWebProject" needs to
have read and write access enabled for NETWORK SERVICE. Or, if your
webiste project is called "MyCustomWebProject", then the folder
"Documents\Visual Studio 20xx\Websites\MyCustomWebProject" needs to
have read and write access enabled for NETWORK SERVICE.
NETWORK SERVICE must be granted both read and write permissions to the App_Data folder located within your web project's directory
structure.
The solution with me is
- On IIS ->> Application pool
- Select Default App Pool (it may be different of your website, please choose your pool)
- Advanced setting
- Identity: ApplicationPoolIdentity
- Load user profile: change to true Restart IIS
SOLUTION FOR ENVIROMENT:
Win 7, IIS 7.0, Visual Studio 2010, Database.mdf File
Open the web config and check the conexion string:
Important, make sure the AttachDbFilename is NOT followed by C:\inetpub\<>\App_Data\
<add name="conexion"
connectionString="Data Source=.\SQLEXPRESS;
AttachDbFilename=|DataDirectory|Database.mdf;
Integrated Security=True;
User Instance=True" />
In IIS 7.0 Go to ApplicationPools, find the application pool created for the application.
Click Advanced Settings
Go to Identity and open it Select Custom
Account and set the PC or Server user admin account
Then go to the WebSite in IIS 7.0 and click it...
Locate and double click the Authentication icon
Click on Anonymous Authentication and select Edit, then Select Application Pool Identity
Locate the ASP.NET Impersonation and edit, Select on Specify User and then enter the credentials.
Restart IIS:
cmd > iisreset/noforce
or click the reset image button
RUN->INETMGR->
go to Sites select your Site
Then go to Right panel and look for "Basic Settings"
Then Click on "Connect as" Then Select "Specific User" Then Click "Set" Enter Local PC User Name And Password Then Click "OK"
Then Click on "Test Setting" if you see Both options are green then Ok.
Problem Solved
Enjoy...

How do I get Visual Web Developer to use IIS, and not ASP.NET development server?

I want to make sure my local is matching the production environment closely and that means running IIS and not the ASP.NET development server that comes with Visual Web Developer express edition. What is the best way to do this?
In Visual Studio you right-click the project, select Properties then Web and change it to use Local IIS. It seems the process is similar for VWD, but there there is a Properties node you open instead. I don't have VWD installed right now so can't check to see if this method is indeed accurate but the article is recent so I assume that it is.
First make sure you have installed and configured IIS server. To check whether IIS server is installed: Run->inetmgr press enter.
To know how to install and configure IIS server check the following Link:
http://chalaki.com/install-iis6-windows-xp-professional-sp3-setup-run-csharp-cgi/425/
To develop Website using Visual developer 2008 with IIS instead of "ASP.NET Development Server", In the new website window under "Location" click on "Browse" to see the different Server options including IIS Server. User can select the server as IIS server instead of "File System", then the "Location" option will be "HTTP" instead of "File System".
In Visual developer 2008 under Properties->Start Option->Server->"Use local IIS server" option is not shown, Even though IIS server was installed and configured successfully. the only options shown are "use default server" and " Use custom server with base URL".
So in Visual developer 2008 to run on IIS server(If IIS server is installed), Need do the following:
New Website -> Under Locations Click on "Browse" -> Click on "Local IIS" and then select the "IIS Virtual Directory"(IIS vitual Directory which is directory created by the user while configuring IIS server) -> Open
While Running/debugging, the server which you selected while creating the website, the same server will used to open the website, that is while creating the website if you selected "IIS Server" then the website will be opened though IIS server.
One more thing is, while installing Visual developer 2008 and IIS server, If you installed IIS server after installing Visual studio then you need to do the following before creating new website:
Run ->cmd press enter (then enter the following Command)-> C:\WINDOWS\Microsoft.NET\Framework\Version aspnet_regiis -i press Enter then you get message after 3 seconds "ASP.net was installed successfully".
(*Version will be v2.0.50727 in most cases)

Problems running ASP.NET application with IIS

I have written a small ASP.NET application. It runs fine when running it with the small IIS installation that comes with Visual Studio 2005, but not when trying with IIS. I created the virtual directory in IIS where the application is located (done it though both IIS and VS 2005), but it does not work. In the beginning I thought it might be caused by the web.config file, but after a few tests, I think that the problem lies with IIS (not certain about it).
Some of the errors that I get are
Unable to start debugging on the web server. The underlying connection was closed: An unexpected error ocurred on a receiver. Click help for more information
Can anybody give me a suggestion of what to try next?
Have you run aspnet_regiis?
Here's an overview site for different IIS versions setup and should help if there are other questions/issues
Try reinstalling aspnet_regiis.exe.
If you are using .net frameworkype 4.0 and using 64 bit system,
Go to Run, Type cmd and Command Prompt will be up, then type
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
If you are using 34 bit system,
Go to Run Type cmd and then type
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
The site won't load at all or you can't debug remotely?
Some thoughts:
Make sure you've got debugging enabled in your web.config, if you're trying to debug. Otherwise, build in 'Release' mode.
Make sure your project is set as an application, and is running as the correct version of .NET
More description of your setup and the error message would be useful.
Make sure that the customErrors is set to off in the web.config. That should show the actual exception.
Make sure that your virtual directory in IIS is set to the correct version of the .NET framework.
Look at the properties in the virtual directory and see that the correct default documents are the ones that you are using in your dev project.
Also look at the url headers for the website in IIS.
On some of our servers we have both versions of the .NET framework. In IIS I typically have to set what version the virtual directory should be using. This can cause problems running it on the server.
First make sure you have installed and configured IIS server. To check whether IIS server is installed: Run->inetmgr press enter.
To know how to install and configure IIS server check the following Link:
http://chalaki.com/install-iis6-windows-xp-professional-sp3-setup-run-csharp-cgi/425/
To develop Website using Visual developer with IIS instead of "default ASP.NET Development Server", In the new website window under "Location" click on "Browse" to see the different Server options including IIS Server. User can select the server as IIS server instead of "File System", then the "Location" option will be "HTTP" instead of "File System".
In Visual developer 2008 under Properties->Start Option->Server->"Use local IIS server" option is not shown, Even though IIS server was installed and configured successfully. the only options shown are "use default server" and " Use custom server with base URL".
So in Visual developer 2008 to run on IIS server(If IIS server is installed), Need do the following:
New Website -> Under Locations Click on "Browse" -> Click on "Local IIS" and then select the "IIS Virtual Directory"(IIS vitual Directory which is directory created by the user while configuring IIS server) -> Open
While Running/debugging, the server which you selected while creating the website, the same server will used to open the website, that is while creating the website if you selected "IIS Server" then the website will be opened though IIS server.
One more thing is, while installing Visual developer 2008 and IIS server, If you installed IIS server after installing Visual studio then you need to do the following before creating new website:
Run ->cmd press enter (then enter the following Command)-> C:\WINDOWS\Microsoft.NET\Framework\Version# aspnet_regiis -i press Enter then you get message after 3 seconds "ASP.net was installed successfully".
(*Version# will be v2.0.50727 in most cases)

Resources