Publish ASP.NET MVC 3 (Razor) app onto remote server running Windows Server 2003 with IIS 6 - asp.net

I have built an ASP.NET MVC 3 web application (with exlusively Razor/cshtml pages) that runs fine on my local machine with IIS Express. Now I'm trying to publish it to a remote server that is running Windows Server 2003 and IIS 6 and has just been upgraded to .NET Framework 4.0.
I was able to successfully publish all the files to the proper directory on the remote server using Visual Studio 2010's Publish dialog (Publish method: FTP), and I've followed the instructions for including all the DLLs needed to run ASP.NET MVC on a machine that doesn't have it installed, but now I'm pretty much stuck.
The first issue is that I don't have access to the remote server's IIS. I may be able to get the hosting company to add a virtual directory or change a setting, but I'm not sure they know what they're doing, and at the moment, I wouldn't know what to tell them anyway.
The second issue is that I need my web app to live inside an existing site (the web app is basically a protected members area of the main website). So, pretend the main site is http://www.foobar.com. I'd like my web app to be accessed by entering the URL http://www.foobar.com/members.
Questions
Is it possible to publish my web app without access to the remote server's IIS?
If not, what exactly do I need to tell the hosting company to add or change in IIS?
Do the settings under the Web tab of project properties affect publishing or just local debugging? At the moment, I have it set to use IIS Express, and the Project URL is "http://localhost:7373/". Do I need to change these?
Given that the remote server is running Windows Server 2003 and IIS 6.0, is it possible to use Web Deploy or am I limited to FTP?
If I can use Web Deploy, what do I put for the Service URL? All I have right now is a URL in the format of ftp://www.foobar.com/www and a username and password.
If I need to use FTP, what steps do I need to take to get the app working once the necessary files have been uploaded to ftp://www.foobar.com/www/members? I'm not worried about database, security certificates, registry, GAC, etc., I just want to know the steps necessary to get the home page of my web app to come up when I put http://www.foobar.com/members.

Have you had a look at this article by Scott Hanselman?
In addition to that article, please read the following thread on StackOverflow on pretty much the same environment as yourself.
Edit
Your first step should be to get the hosting company to set up the virtual directory with the following parameters (IIS 6):
ASP.NET Version: 4.0.30319 (or later)
Local Path: [root ftp path for main website]\Members
[ ] Script source access (unchecked)
[x] Read (checked)
[ ] Write (unchecked)
[ ] Directory browsing (unchecked)
[x] Log Visits (checked)
[x] Index this resource (checked)
Application Name: Members
Execute Permissions: Scripts only
Application Pool: ASP.NET 2.0

Related

Migrate a ASP.Net application from one server to another server

I have developed a ASP.Net MVC 4 application with Visual Web Developer Express 2010. It was successfully published/deployed to a remote server A (development server) using the Web Developer's built-in publishing tool and it works perfectly on it IIS 7.0 with the web deployment component.
Now I want to deploy it to another remote server B (production server). This one sits in an isolated environment and does not have Internet access! Even if server B is a replica of server A, its IIS 7.0 does not have the web deployment tool component installed. So the built-in publishing tool does not work for the web deployment option.
I then tried to publish it using the File System option. I copied the exported files to a new folder on IIS on server B. The folder was configured the same way as its counterpart on server A. I tried the URL on server B and it just gave me directory/files listing on the browser instead of the welcome page of the application.
Has anybody got the experience or tips to solve the issue? Thanks.
Cheers,
Alex
edit:
because it a MVC site, the default document doesn't apply. check the following steps:
IIS Extension Less URLs are enabled and allowed.
ASP.NET 4.0 is installed and registered. C:\Windows\Microsoft.NET\Framework\<version> and then aspnet_regiis -i (this will typically force IIS to use the MVC infrastructure instead of using the default document methodology)
Ensure App Pool is in 4.0 Integrated mode.
Ensue that the IIS Advanced Settings for the website are showing the right root folder path.

ASP.NET error log

Every time the ASP.NET application in question throws an error the Global.asax writes to an error file: logs\error.log. The ASP.NET applications works using Windows authentication.
I am able to write to the log file when debugging using Visual Studio, however it does not work when the application is deployed in the live environment. How do I find out what user account I need to give access to: logs/error.log?
The application is deployed on a Windows 2003 Server with IIS6. Microsoft.NET 3.5.
You would have to give the required permissions to the network service account. This link might be able to help you out.
Windows Server 2003 defaults to the "Network Service" account.
This can be verified by opening IIS (expand the computer if needed), expand the "Application Pools" folder, right click on the pool used by your web app, and go to the Identity tab.
FYI: Windows Server 2008 uses the IIS_IUSER instead of Network Services.
I hope that logs folder is a virtual directory setup outside the web site directory.
Otherwise every time you deploy the entire solution you will overwrite the logs folder and its content.
Microsoft has a tool for monitoring file access that can be useful for troubleshooting permission issues.
Process Monitor - http://technet.microsoft.com/en-us/sysinternals/bb896645
You will also want to check if your application is using windows authentication & identity impersonation since that can change the identity the application is executing with when enabled.

My ASP.NET application is not working on the server, but it works in my development environment.

My ASP.NET application is not working on the server, but it works in my development environment.
How do I go about debugging this?
First, when posting such a question to stackoverflow, post as many details as possible. These people on this site are brilliant and can fix your problem in a snap if you provide them enough information.
Confirm that you have deployed ALL dll, aspx, ascx, .vb, .cs, exe, image, and config files.
Confirm that you have deployed ALL folders
Confirm that your web.config has a valid connection string
Confirm that your entire folder tree has read/write permissions for network service account. (this can be backed down later)
Confirm that your entire folder tree has read permissions on the IUsr account
Confirm that your application pool (IIS Manager) has the same .NET Framework as your application was compiled in. It's probably .NET Framework 4.0, but might be 3.5 or 2.0
Confirm that the web server has port 80 and 443 open in its firewall
Confirm that asp.net is installed on the web server
Navigation to C:\Windows\Microsoft.NET\Framework\v4.0.30319 in the command line and run aspnet_regiis.exe -i if you need to reinstall asp.net 4.0. Sometimes this fixes problems.
Confirm that the web server serves up an html file. Add a file called test.htm to the root folder, and only include "Hello, I am test.htm" as its contents. Attempt to visit this in a browser. If it does not load, check permissions again.
Confirm that you have a dll on the server for every custom reference that you have added to your project, and confirm that the dlls are at an accessible path to the deployed web application (like, sitting in the bin folder)
I have the same problem as the person that post the question. I my development machine it runs smoothly. Deploying it in my own development machine opens the website bu gives me different w3wp.exe codes when opening a specific page inside my website.
I t seems it is a memory problem. I have tried different approaches but nothing seems to work.
The page that I am trying to open in has different linq queries.
I answer as much as I could from your questions.
Confirm that you have deployed ALL dll, aspx, ascx, .vb, .cs, exe, image, and config files.
Yes
Confirm that you have deployed ALL folders
Yes
Confirm that your web.config has a valid connection string
Yes
Confirm that your entire folder tree has read/write permissions for network service account. (this can be backed down later)
Confirm that your entire folder tree has read permissions on the IUsr account
Confirm that your application pool (IIS Manager) has the same .NET Framework as your application was compiled in. It's probably .NET Framework 4.0, but might be 3.5 or 2.0
Yes 4.0
Confirm that the web server has port 80 and 443 open in its firewall
Confirm that asp.net is installed on the web server
• Navigation to C:\Windows\Microsoft.NET\Framework\v4.0.30319 in the command line and run aspnet_regiis.exe -i if you need to reinstall asp.net 4.0. Sometimes this fixes problems.
Confirm that the web server serves up an html file. Add a file called test.htm to the root folder, and only include "Hello, I am test.htm" as its contents. Attempt to visit this in a browser. If it does not load, check permissions again.
Confirm that you have a dll on the server for every custom reference that you have added to your project, and confirm that the dlls are at an accessible path to the deployed web application (like, sitting in the bin folder)

How can I deploy an ASP.NET web on IIS without creating a separate site?

I've created an ASP.NET web tool that will just be used by a few people in my team where I work. I deployed it on our internal (Win2k, IIS6) web server by creating a new website in IIS and assigning it port 81. Users can access it with an address like http://myserver:81. All the other web stuff on the server is classic ASP and is accessed with addresses like http://myserver/path/to/myfile.asp.
This works fine, but I'd rather set it up so that the ASP.NET app is not configured as a separate web site, and is just accessed via a folder path like the classic asp stuff. That way users wouldn't have to specify the port and we wouldn't get the overhead of an additional web site for every little ASP.NET app we make.
The problem is when I build the site in visual studio, it compiles all the .cs files into one .dll file, and if I just copy everything over to some folder on the server and type the address of the .aspx file, it can't seem to access any of the c# functions in that .dll file.
Can an ASP.NET app be set up like this, short of writing all C# code within the .aspx files?
Assuming you want your application to run as a subfolder of a website bound to http://192.168.1.1:
Build your website, and drop it into a subfolder called "A" in the root website folder
Verify that Network Service and IUsr accounts have read access (at least) to your Subfolder
Verify that the application pool serving the website is using the same version of the .NET Framework as your application (Probably 2.0 if you're using IIS 6)
Verify that the application pool is running under the Network Service Identity
Right click the folder in IIS, and convert it to an application
Make sure you setup an adequate default file on the application, such as default.aspx
Access http://192.168.1.1/A/ and your application should load
Note: All applications in the website must run the same version of the .NET Framework

I don't seem to have an ASPNET user account running on my machine

Hi: I'm reading up on ASP.NET, and just came to a chapter that explains how to upload a file to your website. It says that in order to save a file to your file system, in the case of every OS except Win Server '03, an ASP.NET page executes in the security context of the ASPNET account. I don't have an ASPNET account running on my machine (win xp pro sp3; .NET 3.5). The program runs fine, by the way, I'm just trying to understand what an ASPNET account is exactly, and why it doesn't seem to show up on my list of user accounts. Thanks.
ASPNET is only used if use IIS. This was the norm in ASP.Net 1.1
However in new versions of Visual Studio IIS is not needed, so it uses an internal web server.
If ASPNET exists in a command window ( Start -> Run cmd Clikc OK) type and press enter
net user ASPNET
you should see the details of the account and in Task Manager you will see a process asp_wp.exe
File Access
The Network Service account has Read and Execute permissions on the IIS server root folder by default. The IIS server root folder is named Wwwroot. This means that an ASP.NET application deployed inside the root folder already has Read and Execute permissions to its application folders. However, if your ASP.NET application needs to use files or folders in other locations, you must specifically enable access.
http://msdn.microsoft.com/en-us/library/ff647402.aspx

Resources