Debug asp.net4 website local session as the app pool identity - asp.net

I have a bug in a website that is using trusted connect to access a database. I do not get the error when debugging locally. I believe this is down to the specific permissions assigned to my personal windows account.
Is there an easy way to run the website (visual studio 10 debugger/Casini) as the app pool identity in question and step through?

You can actualy debug IIS process using Visual Studio.
Go to menu "Tools" and select "Attach to process..."
Make sure you check "Show processes from all users". You should be looking for "w3wp.exe".
In this way you can attach and debug process runing on IIS (your app).

Related

Credentials popup when debugging in VS 2017 IIS Express

I have an VS (2017) Web Application project. The project complies and runs correctly etc.
The problem I have is when I press the debug button and it starts debugging using IIS Express in Edge, I am always presented with a popup to provide credentials before the page is shown. The page is loaded correctly once the credentials are provided, but I have to do it each time and it can become annoying.
Anonymous access is disabled and Windows Authentication is enabled in the Project Properties.
I a have tried running VS in adminstrator mode but no luck.
How do I not have the credentials box appear?
set the hostname which you are using in the iis site binding to the visual studio project.
1)Open the project which you are using to attach the worker process for debugging.
2)Right-click on the project -> select properties
you will see that there are 3 options for executing your application. IIS Express, Local IIS or External Host.
You can now use Local IIS like the configuration below.
A second option, that is if you are using like me a custom hostname, is to select External Host.

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.

Crystal Report VS 2008 - multiple tables report deploy

I am having a problem with deploying a multiple tables report into my IIS server. The page shows : "The report you requested requires further information". However, I have tried to set databaselogon at the server-side but it didn't work. (The report is working fine on VS Debugging Mode)
It is confusing that it happens only to a multiple tables report and it is working fine on a single table report.
I am using VS2008 and CrystalReportViewer version 10.
When you get "The report you requested requires further information", are you prompted to log in? I think that is the header message for DB authentication required.
If so, what you need to understand is the concept that the Crystal Reports runtime runs within the security context of the ASP.NET server. Your database connections within the Crystal Report are probably set up to use Integrated Authentication, which means the report will authenticate to the DB server using the credentials of the ASP.NET process.
In debug mode, the ASP.NET development server runs as your user account. Undoubtedly, you have access to the DB. However when you try to run in production mode, the ASP.NET server (by default) is either running as a local account called ASPNET on the IIS server, or as the NetworkService account, depending on what version of IIS you are running.
If you are running IIS 7.x, you need to either give the IIS server's directory object (NtDomainName\ServerName$) access to the DB, or change the security identity of the application pool associated with your ASP.NET application.
Hopefully this sets you on the right track and if you still need more help please post what version of IIS you are running and more information on the error message you are getting.
Response to Comment:
To configure Application Pools, in IIS Manager, select the Site in question, click Basic Settings... and check the Application Pool it is assigned to. Then go into Application Pools, you should see the current Identity of the pool listed. This is the account the application "runs as". This account needs to have access to all the files and resources in your web application, including your MySQL DB.
You can edit the Identity settings in the Advanced Settings dialog for the Pool.
Unfortunately I can't give you any advice on MySQL since I have never worked with it.

Execute a dll function in ASP.Net Bin not working, II7

I am developing a remote control application where a client (aspx page in a browser) can request a server to "launch a notepad" (for testing purpose, for real life, turning off a light bulb, etc). So I created a dll with a simple function for launching the notepad (on the server side) and dropped this dll in the root bin folder.
It worked fine when the aspx page is running under ASP.NET development server (launched from Visual Studio). But when I tested the same aspx page under a FireFox browser, it did not work (launch the notepad) even though it did call for the same function (I stepped through in debugger).
Is this a permission issue? How do I set this up in IIS manager, or even better in web.config?
Please help.
Yes, it sounds like a permission issue.
The application pool in IIS 7 that your site is running under is probably using the default identity, which is the most restrictive. You can change the identity in IIS Manager by right-clicking on the app pool (probably called DefaultAppPool) and selecting Advanced Settings. From there change the Identity value to Local Service or Network Service. If neither of those work, making it Local System should allow your page to work.
I assume the Visual Studio integrated web server runs under the context of the account you are logged in with on the machine, which likely has a lot more rights.
When you say:
it did not work (launch the notepad)
Did you mean it through an exception or you didn't see a notepad window open. If it was a permissions issue I would expect you that you would get an exception. Chris is right on when he says:
The application pool in IIS 7 that
your site is running under is probably
using the default identity, which is
the most restrictive.
and
I assume the Visual Studio integrated
web server runs under the context of
the account you are logged in with on
the machine, which likely has a lot
more rights.
and if this is a permissions issue he is right on. However, the user your running under (when not debugging in Visual Studio) most likely cannot access the desktop of the logged in user. Maybe you should try your test with an app that doesn't need to interact with the desktop.

Visual Studio 2005 says I don't have permission to debug?

I am new to visual studio/asp.net so please bear with me. Using vs 2005 and asp.net 3.5. I have vs installed on the production server. If I set the start option for the site to "use default web server" when I go to debug my website vs tries to open the site at http://localhost:4579/project and returns 404. If I set start option to "use custom server" and specify the correct path to application (the way I would hit the site from the outside) vs is unable to run debug and returns error "Unable to start debugging on the web server. Logon failure: unknown user name or bad password". I am running vs as an administrator on the production server. I thought maybe I needed to set user permissions in the visual studio remote debugging monitor but my admin account was already there. I checked IIS and made sure the application configuration/debugging "enable asp server-side script debugging" was checked. Web config is also set debug="true". Clearly I am missing something.
EDIT >Running windows server 2003
Do this...Instead of trying to debug by hitting F5
Go to Tools
Attach to Process
Click View Processes from all users
Ensure you are selected only for Managed Code
Select "W3WP.EXE". This is the ASP.NET Worker process.
Click attach.
You are now attached and debugging, go refresh the page in a browser and it should hit your breakpoints.
Are you running on Vista or Server 2008? I'm not sure about Vista, but when I was running Server 2008 I had permission errors when trying to debug when I launched VS as my regular user. The solution for me was right-clicking on the VS icon and selecting 'Run as Administrator'.
The account you are running under needs to be part of the developer user group. Otherwise you will not be able to debug correctly.
Have you checked that you have Integrated Windows Authentication switched on for the required web site. This is required for debugging.
Note: You can have this and the Annonomus access enabled at the same time. This means the site sees logged in users as their user account and not logged in users as the Annonymous account. Not logged in users will only see a login box if the application tries to access something that requires a login.
To debug Javascript you have to enable it in IE's settings. Uncheck both the settings at "IE->Tools->Options->Advanced->Browsing->Disable script debugging" before debugging.

Resources