I don't seem to have an ASPNET user account running on my machine - asp.net

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

Related

IIS 10 getting 401 unauthorized

Deploying an asp.net project on local IIS server as a release version. Getting 401 unauthorized error on API call (allow anonymous enabled). Server runs with administrator user principal. This principal has all the permissions. And the project declared as application with correct .net library. The only thing I can't change is read only flag on the project directory. Anyone can help? Nothing in google resources worked...
Update: After a lot of searching and digging, I found a solution:
IIS Application basic settings - The default settings is to run application with Application pool user, which is usually limited with it's files access permissions. So the idea is to run application with administrator user.
Run as - enter administrator user name and password
Application pool type - The default application pool type is 2 and sometimes new .NET libraries are not accessible. So you have to add all the missing ASP.NET types to IIS.
Usually ASP.Net version suppose to be classic, in this case application works fast. Otherwise application refresh time may take long period.
Local folder permission - add local administrator, that you defined on IIS settings, and grand him all permissions to the folder recursively
SQL Server Management- the default server authentication is Windows Authentication, make it SQL Server and Windows Authentication mode
Add new user to the server and grand him all the permission to the database
Add this user to database Users and change the SQL connection string at the project accordingly. This way you prevent application pull trying to connect with database with it's user
Just posting this here as I went around in circles trying to diagnose an intermittent 401 error.
I had a virtual sub directory within the web application that referenced an external folder which was out of the directory tree so had different folder permissions.
Any scripts that referenced this folder failed - while others ran completely fine.

using Process.Start in an IIS Website

I have created an ASP.NET website using VB.NET. The functionality of the website generates a .bat file and saves it in a location - it then uses Process.Start(filelocation) to run the bat file.
This works fine when in debug mode on my PC - but when I have uploaded the website on to an IIS 7 server, it creates the file (proving that it has access to the area), but seemingly cannot run it?
I am assuming there is a permission issue here - Any ideas what I am missing?
Thanks
Guy
Every webapp in IIS run under a specific user. Check if that user has privileges to run applications, in particular the *.bat (in your output directory) and related *.exe files.
If you do not use impersonation, you can set the user at App pool level.
My suggestion is to create a dedicated Windows user with the right permissions and run the app pool under that user. The app pool should contains only your web application.

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)

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

Resources