Configuring ASP.NET to run under IIS in Windows 7 - asp.net

How do I configure an ASP.NET application to run under IIS in windows 7? I am using Visual Studio 2010 and when I run my web app I am getting an error message that you do not have permission to access the web server.

you have a couple of options.
1) copy the files to your inetpub\wwwroot folder then open iis manager and create an application in the Default Web Site of the folder you just created.
2) in Visual Studio, you can publish
3) in Visual Studio, you could open the properties page of the web application, click on the web tab and in there, an option for creating the virtual directory exists. Press it - it creates the virtual directory and you can then run the website using that url. VS will automatically launch the site pointing to IIS when you run the app
remember, be sure you are running in Administrator mode (if using UAC).
one more thing - be sure you have installed IIS (Programs and features > Internet Information Services)

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.

Unable to run migrated web application in VS2013

I have an ASP.Net web application developed in Visual Studio 2008 (.Net 3.5). I have copied this solution to another root folder (both on my Win7 64b machine) and upgraded the copy to VS2013 (Professional) and .Net451, but when I try to debug the web app in VS2013 I get an Access Denied error ("Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server"). I don't have this issue runing the original from VS2008 on the same machine.
Apart from the changes mentioned above the two are a straight code copy.
In VS2008 the project Web properties are: Use Visual Studio Development Server, auto-assign port, Virtual path = /
In VS2013 the project Web properties are: Server=IIS Express, Project URL=http://localhost:63064/ (and I have clicked on Create Virtual Directory)
I can see this must be some sort of security issue, but what extra needs to be done to get a VS2008 web app, upgraded to VS2013, to run within the VS2013 IDE?
Postscript: If I start the web app without debugging (ctrl-F5) I get "HTTP Error 503. The service is unavailable."
It turns out that the simple solution is configure the web app properties in VS2013 to use the local webserver (IIS) instead of IISExpress, and also to run VS2013 as administrator (but this is not necessary for VS2008). So obviously it is an IIS permissions thing but IIS is common and hasn't been changed - so what has changed in VS2013 to make this necessary? I don't really want to run VS2013 as administrator if I can avoid that.

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

ASP.NET and IIS 7.5: Creating a virtual directory

I have written an ASP.NET MVC 5 application in Visual Studio 2012, and I am now attempting to run it on IIS 7.5. Following a tutorial, within IIS Manager I have created a virtual directory, whose physical address is the address on my computer of the web application. That seems to work fine.
However, the tutorial also says that an alternative way to create this virtual directory is from within Visual Studio. Again following the tutorial, under the project Properties->Web, I select Use Local IIS Web server, and then type in http://localhost:8010/MyWebApp as the Project Url. Then, after clicking the Create Virtual Directory button, I receive the message The virtual directory was created successfully.
However, I notice that this virtual directory does not appear in fact appear in IIS Manager, even after refreshing or restarting. What am I doing wrong? (Note that Use IIS Express is checked, if that makes any difference.)
Using IIS express is the issue, the IIS manager is for the inbuilt IIS instead.
If you untick that use IIS express box, it will remove the port number and you will create a virtual directory under the main IIS installed.
http://localhost/MyWebApp
Note that VS must be run as an administrator for it to be able to access the IIS metabase, otherwise your web app project will fail to load.
If you are running on a base install, you may also need to install some extra features into IIS to get it working properly.

how to load webapplication on server

I have made a web application using Visual studio 2008. till now it was running on my local host..
Now i want to load it onto the server so that it can run on my company server.
How do i do that..??
Thanks
In visual studio:
Under the Build menu, select Publish
In the publish dialog, select a location to publish your application to
ex: \\server\c$\inetpub\wwwroot
Set your publish options. I reccomend using the "Only files needed to run this application" setting
Click the Publish button
You will have to mark your deployment directory as an application in IIS for IIS to run your code. See this MSDN article for details on how to do this.
You just need to copy it into the IIS directory on that server, usually c:\inetpub\wwwroot. Make sure you have asp.net installed.
You can use the project menu and copy it to a remote server (specifically the machine that will host this project, in addition a web server). Or you can just go to the remote machine, add a new site and store the .aspx pages and all related images on the web servers inetpub\wwwroot folder.

Resources