I'm getting "Unable to start program http://localhost:[port] Access is denied." when I try to debug an ASP.NET MVC app. Here are some more details, some of which may not be relevant.
This is happening under a somewhat different context for this project. I recently obtained an elevated account on the network, so now I'm running VS 2017 (15.5.4) as Admin every time I start it so that I can access the TFS server. Previous to this, I had been working offline with my non-elevated account and passing code changes to another developer for him to check in to TFS. I am still logged on to the local PC (Windows 10) with my non-elevated account. I just start VS as an admin and when prompted enter the credentials for the elevated account.
This morning was the first time I ran VS under this new context, got the latest code, and tried to do some work. I had to delete an existing TFS workspace, but I did get a complete refresh of the code from TFS.
The first time I went to F5 the code in this new context I get a warning about the app using SSL and VS wanting to self-sign a certificate. I said yes. I forget exactly what happened at that point, I think the browser (Firefox) timed out trying to connect. Anyway, I tried a different browser (Chrome) and still no luck.
Yet now, whether I , +, , or , I very quickly get the message from above "Unable to start program..." I've done a lot of searching on this problem, but have had no success in getting close to a solution. Here's what I've tried:
Cleaned the build and done a fresh rebuild. Building works, no issues.
Use netsh to look for (and delete) URL reservation. There wasn't one.
Tried using a different port.
Deleted temporary asp.net files.
Turn JavaScript debugging option off in VS.
Crtl+F5, w/o debugger.
Turn SSL off for the project.
Checked, Windows Authentication is on in web.config.
Used Process Monitor to look for any "access denied" for either devenv.exe or iisexpress.exe
So what I'm hoping for here is not so much a silver bullet (though that would be great), but more some help in troubleshooting. Access denied means some resource--a file, a registry setting, a network share, something--is inaccessible in the context in which I'm running. Exactly what that is has got to be recorded somewhere, I hope. What log files does VS write to when you hit ? I've looked at the output during build and there's nothing there.
I'm sure I haven't exhausted all resources in troubleshooting this, I just need some help on where to look. Also, I had to leave that project/site and head to another, so I won't be able to try any ideas you all throw at me until tomorrow, at the earliest.
Please take a look at these answers in a similar question. From the list you provided it appears some of these may be new things to try for your case.
Specifically, I have run across the following answers in that linked question that have worked for me at various times in my career:
If you're using Anonymous Authentication, IIS 7 will use the "IUSR"
account for directory access (unless you've set it to use the app
pool identity. If you haven't granted IUSR sufficient permissions on
your site's folders and files, you'll get this error
For me in windows 7 it started to work only after I gave 'Read &
execute', 'List folder contents', 'Read' permissions to site folder
for both users
IUSR
NETWORK SERVICE
I had the same problem, I enabled "Anonymous Authentication" but it
still did not work. So I also ENABLED "Forms Authentication" Then it
worked without any problems. (also try windows auth)
For me, nothing worked except the following, which solved the
problem: open IIS, select the site, open Authentication (in the IIS
section), right click Anonymous Authentication and select Edit,
select Application Pool Identity.
I gave access to "IIS_IUser" but instead it should be "IUSR". That
solved the problem.
I have a very similar problem with yours and my architecture uses windows authentication and what works for me is selecting my project and going to properties. Then select "Enabled" on Windows Authentication.
Related
I am trying to deploy a lightswitch app via web deployment. This will be a web application. It seems to publish just fine, and after a long period of troubleshooting, a coworker and I were able to finally get an admin user added, but now the site just shows a white screen with "Loading," but nothing else ever happens. We are using .NET 4.0. There is no indication of an error, and we have the trace logs available, but I don't see anything that looks like an error. Does anyone know what might be happening. I am using VS 2012.
Thanks!
If you're Debugging the app locally, and you're using forms authentication, and have the "Application Administrator Already Exists" option selected in Publish settings, you're always taken to the Desktop Client in order to "Setup" administrators. Simply navigate to the HTMLCLient (or whatever you've called it) by typing "http://myapp.com/HTMLClient" into the address bar. This should allow you to use your app, or at least login.
I have an MVC application in which users are able to upload files. Before I write the uploaded file, I create a directory according to date time. I start off with C:\ApplicationName and end up with C:\ApplicationName\20111001\Filename.ext when the upload is completed (in theory).
My problem on my local Windows 7 machine is that I can not write the file.
I get an "access denied" exception no matter which user I give full access to the directory. The strange thing is that the date directory gets created just fine.
I have given the following users full access:
[Current logged in user]
NETWORK SERVICE
IUSR
IIS_IUSRS
Guests
Everyone
Without any success. I really don't understand what is going on here. When I give Everyone full access, I should be able to create a file right?
PS: I use Visual Studio 2010 and ASP.NET Development Server straight out of the box.
I am not running IIS, I am running the watered down version "ASP.NET
Development Server". So I am quite limited
The problem is that in order for you to write to the file directory from the application you will need to run Visual Studio as Administrator.
Windows 7 is preventing the process from going outside of its sandbox because it is running with limited privileges. This is true even if your account is the administrator.
Check the permissions of the parent folder and make sure they are inheritable, you can check this on the advance options window.
This might help a bit... probably application pool permission is the culprit here:
IIS AppPoolIdentity and file system write access permissions
Just had the same problem myself. By default IIS7 AppPools use AppPoolIdentity. Just open up your AppPools in IIS Management Console, select the one you are having problems with, choose Advanced Settings and under Process Model change Indentity to Built-in Acoount > NetworkService.
Since you have already granted NETWORK SERVICE acces to your folder everything should work.
We have a C# web application, and the latest deploy doesn't work on our Windows Small Business Server 2008 (IIS7). The exact copy of that site runs fine on my Windows 7 machine (IIS7.5). The previous version and other builds still work on the Server 2008 R2 machine, but this itteration doesn't.
I've checked the W3SVC logs, but no requests are logged. I've checked the eventlog for errors, but no errors are logged. I also checked in fiddler, but the request just doesn't get a response as far as I can tell (Result column remains -)
When you open the url, the browser will just keep loading (no timeout).
Is there anything else I can check or enable to debug this IIS7 behaviour?
Thanks in advance,
Nick.
UPDATE
I published the application again & created a new site in IIS, and this new version works. While my the immediate problem is solved at this time, I would still like to know how to debug IIS7, see how it works & why it would keep loading infinitely.
First, I would drop a regular .html file into the sites directory. Then I would have a browser request that specific static file. This would bypass the .net engine and should be logged.
If for some reason it doesn't work and/or isn't logged then there are other things to check, let us know.
Assuming that it does serve the file and you are pointing to the correct machine then inspect your global.asax file and remove any type of error handling you might have. Also turn off the custom errors section of your web.config. Both of which could result in the server essentially spinning off into nothingness if improperly coded. If you have any type of additional threads you are spinning up on access, then see if you can turn those off or add additional logging.
Next, look in the HTTPERR logs to see if you can identify what's going on. These are located at
%SystemRoot%\system32\LogFiles\HTTPERR\httperr*.log
Info about this log file is at: http://support.microsoft.com/default.aspx?scid=kb;en-us;820729
If your app uses ADO then there is chance that depending where the build occurred on Windows 7 or not and whether SP1 is installed or not (at the time of the build) that your build is broken by some Micorsoft ADO-update contained in SP1 (see http://www.codeproject.com/Articles/225491/Your-ADO-is-broken.aspx).
If no requests are logged in the W3SVC logs then it probably means that IIS is not recieving the request at all - likely due to firewall configuration or similar.
You should diagnose why IIS is unavailable (for example by attempting to serve some static content) and then try again.
Try these:
re-register asp.net runtime with your IIS7
make sure the asp.net extension for the correct version is set to Allowed in 'ISAPI and CGI restrictions' in your IIS
Environment:
win2003 running IIS6 serving asp pages that call delphi code.
Delphi code contacts a c# webservice for which it needs to login (login.asmx). Webservice logs show login is successful. Debug results show that Context.User.Identity.IsAuthenticated returns true.
After login, delphi code doublechecks if it is still authenticated. Webservice returns false -> Context.User.Identity.IsAuthenticated returns false.
Our guess: authentication cookie received by delphi code running under IIS6 credentials (network service?) does not get saved to disk, so login is lost.
Filemon shows 'C:\WINDOWS\Temp\Temporary Internet Files' access denied. Giving IIS6 user admin rights on that folder fixes the problem, but is not acceptable since cookies should work by default.
Running IIS6 in IIS5 compatibility mode fixes the problem, but is also not preferred
Wanted solution: exact cause of problem and smallest modification possible in configuration (giving admin rights to IUSR is not an option)
Cookies do work by default, but you have to have somewhere to store them. If you don't want to give access to the normal place where they are stored, then you will need to set up another directory that you can give rights to and set it up as the internet cache for the IIS6 user.
A couple quick resources that may help, given that for this type of problem you have a fairly large number of potential issues, see this.
One important difference between IIS5 and IIS6 is that Windows 2003 underwent a significant security lockdown with the SP1 update. There are a very large number of things that worked for Windows 2000 that just will not in 2003 (and should not have - they opened the door to all sorts of shenanigans). Trying to track down all the places where IIS6 locked stuff down might be challenging, instead I would use the above resource to track down the common issues people are running into with IIS6.
Every so often when I'm debugging, I get this message in nice brown text on an ASP.NET error page:
Access to the path
"c:\windows\microsoft.net\framework\(version)\Temporary ASP.NET Files\(blah)"
is denied.
I've never been able to figure out what causes it, what really fixes it, and why it happens.
Often times the path after the "Temporary ASP.NET Files" portion (the "(blah)") does not exist, so I'm not sure why it's looking there.
Sometimes an IISRESET fixes it, and sometimes it doesn't.
Sometimes an aspnet_regiis fixes it, and sometimes it doesn't.
Sometimes a reboot fixes it, and sometimes it doesn't.
For what it's worth I ran into this today with some .NET 1.1 code (yes, still maintaining some - hoping to upgrade it soon) and I'm not sure if I've ever seen it with .NET 2.0 and above.
Does anyone know what causes this and what should fix it? I assume it has multiple possible causes but I'm just curious if someone could shed some light on it.
It was my understanding this can be caused by anti-virus running on the machine and intermittently locking the files.
It could happen if the Windows indexing servicing is turned on for the temporary directory. See this article for details. Run File Monitor (available at sysinternals.com) and put a filter on the temporary directory. When you get the access error, see what application is causing the issue. It will most likely be the virus scan - exclude this directory from the scan and see if the problem is resolved.
By default, ASP.NET applications run under either the ASPNET account (IIS 5) or the NETWORK_SERVICE account (IIS 6/7). They also use the IUSR_MACHINENAME account if you have anonymous turned on for the site. Give these accounts full permissions to the temp directory you're having access problem with.
This could also happen when the IIS user doesn't have permissions into the \Temporary ASP.NET Files directory
Add the user "everyone" to the permissions on the folder Temporary ASP.NET Files
I solved this by granting Full Control to the group IIS_IUSRS on C:\Windows\Temp after running process monitor and filtering for Result is ACCESS DENIED.
csc.exe was trying to create a file in C:\Windows\Temp and did not have permission to do so.