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

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)

Related

Deploy website from a Windows XP Desktop

On my Windows XP desktop, I have a fairly simple ASP.NET targetting .net 4 in Visual Studio 2010. I can run it on my local host by ctrl + F5, it works all fine.
I have a Windows Server 2003, that I can access via mstsc, but also via Explorer. When I go to the publish section of my build properties, i see 4 publish methods :
Web Deploy, FTP, File System, FPSE
I have already installed IIS 6 successfully on the Windows Server, and given all authorizations for everything I could so far (to get things to work in the first place, will check on that later).
How should I proceed to publish to that remote machine ? Should I target a specific folder ? Do I need to setup things in IIS 6 for that site first ? Or will it all get settled from te properties I have in Visual Studio ?
Thank you guys,
J.
Personally I've always plumped for a manual deployment; that is I create the Web Site in IIS creating an appropriate AppPool and targeting the correct .NET version to utilise. From there simply copy (xcopy if you will) the appropriate files over, e.g. DLL and all supporting pages such as ASPX, CSS and associated images. In most situations where I have direct / RDP access this is what I run with.
That said, this can be automated from Visual Studio and this can be useful for those situations where you're maintaining an awful lot of sites on a regular basis. With IIS 6 and Visual Studio, this was achieved by installing FrontPage Extensions on the server then utilising the Publish option.
For VS2010 it seems this has been streamlined using the IIS Web Deploy module and configuring the Studio to publish in this manner that looks mildly quick...
HTH
I've never used the Web Deploy feature in 2010, so I can't really tell you about its merits or drawbacks. I've read that it works much better with IIS7 than IIS6. If you have direct access to the IIS root folder on the server (typically c:\inetpub\wwwroot) through a network share I would recommend doing the file system deployment. FPSE works as well if you have to publish to the server through a remote URL, but there are some security issues with FPSE that make enabling it on your web server a less than ideal choice.
Once the files have been deployed, all that should be left is to configure the website as an application inside of IIS.
Remote in to the web server and open IIS
Right-click Default Web Site and choose properties (if you've deployed to a subfolder in the root, then locate that folder and choose those properties instead
Switch to the Home Directory tab (Just 'Directory' for a subfolder)
Look for the Application Settings section and click the button that says Create
Optional: Select an app pool if you have created a custom one from the default
That should enable IIS to execute your .aspx files inside of your application. Once you've successfully configured the app for the first time, you can just keep publishing your app to the same location over and over without having to reconfigure it.

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

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

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

Windows Server 2003 IIS Renders ASP.NET 4.0 pages as blank

I have a web project which works fine on my local development machine.
I copied the project to our UAT server, setup a virtual directory pointing to the project and configured it to run on .NET Framework 4.0. I even added the Default.aspx page to the Documents tab. I configured Directory Security to use Windows Authentication.
When i try to access any web page within this application, IIS responds with a blank page. I looked through the event logs and don't see any errors anywhere.
Can someone please help me understand what's going on and how to remedy this?
Thanks in advance!
If you're just seeing a white page with no errors in the event log, it sounds like it could be a problem with the application rather than the hosting environment.
However, there are a few things you could try to doing to troubleshoot this.
Check folder permissions. Try allowing "Everyone" access on your webroot folder and see if that makes any difference.
Confirm that the IIS path is set up correctly but putting a text file in your webroot folder, and then browsing to it and verifying that it's contents are displayed.
Create a basic test.aspx page without any script, just a "Hello World" bit of text, and try browsing to it. Confirm that it displays the correct content.
Edit web.config and turn off custom errors
Try re-registering the ASP.NET extensions with IIS using aspnet_iis (details here)
Hopefully, one of these tests will be able to give you some kind of detailed error message or more insight into the cause of the problem.
For IIS 6.0 on Windows Server 2003, after the install of .NET Framework 4.0, the process of creating Web Sites or Virtual Directories that run under .NET Framework 4.0 is as follows:
Create a new application pool.
Applications running under different
frameworks can't be hosted in the
same application pool, i.e. create
an application pool perf framework.
Next, if you are creating a local
intranet site or virtual directory,
ensure that you don't have "dots" in
the application name. Browsers
confuse the dots to be external web
sites, forcing them to run under
internet zone as appose to the
intranet zone.
Once you create your web site or
virtual directory, make sure that it
runs under an application pool
dedicated for .NET 4.0 applications.
Ensure that when creating your
website or virtual directory, you
click on the ASP.NET tab and select
version 4.0 from the drop down.
Then you may configure as per
normal, with any other additional
settings you may require.
Hope this helps someone experiencing similar issues. Took a while to figure out.

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