Asp.net - publishing a web site is causing an access denied error - asp.net

I am working in visual studio 2008 sp1 and trying to publish a web site to a local directory. I keep getting the following error :
Error 3 Access to the path 'C:\Users\name\Documents\Sandbox\BTNET\App_Data\BTNET.mdf' is denied.
My question is how do I determine what user account Visual Studio is running as? I have tried to give everyone, guests, and IUSR_ full control and I am still getting this error. It’s painful..

You must "run as Administrator" VS2008 and publish site

Bring up task manager (ctrl+alt+delete) and look for devenv.exe.You should see the user in the User Name column.

AFAIK (As Far As I Know), it's ASPNET account
Since you're having problems accessing the DB file, make sure all the connection to that database are closed. That file might be in use, which in turn will cause the error.

It sounds like either an application is open and using the file(i.e. Visual Studio, modifying the schema or data or an instance of Access) or the user publishing the files does not have access to the delete files.
The first scenario is more common.

Related

Problems publishing site to localhost on windows 2008 rs server

I must preface this post by saying that I am not an experienced developer, I am in the process of learning through trial and error and a lot of google searches so detailed (step-by-step) feedback would be greatly appreciated. I created a website, which does not use a database, using visual studio 2015 and I am attempting to host it locally on a Windows 2008 R2 server.
I installed IIS and loaded the asp.net v4.0 framework. The site works fine, produces no errors when I test it and works after being published only if the visual studio is still running.
However, when I close the Visual studio and open my browser window to http://localhost:50044 (which is the URL listed in properties menu in VS), I also tried using port :80 and nothing. When trying to add Web Site via the IIS management utility I receive the following authentication error: ”Cannot verify access path (C:\Inetpub\wwwroot).”
I checked the permissions and windows authentication is enabled with read access, and all other permissions seem to be correct. I am at a loss, I'm sure it is probably something simple that I am missing due to my lack of knowledge and experience. Any help would be appreciated.
It's sounds like you are running on IIS express which in your case stops running when you close visual studio. Normal process is create a new website in IIS and point to the folder where your web.config is. You can then hack your host file (C:\Windows\System32\drivers\etc) so DNS works. Add an entry like "127.0.0.1 mytestwebsite.com". I hope that helps
So I figured out part of what was happening. I didn't realize that visual studio has built in IIS and was using that by default.
I ran VS as an admin, created a new project, then attempted to create a virtual directory thru VS under the project/properties/web tab. I selected local IIS and entered http://localhost/boc and it returns an error: unable to create vd. Web server http://localhost... Could not be found.
I then went in to the IIS manager and set up a virtual directory with no issues. However, when I attempt to reference it thru VS I again receive an error message.
Any ideas?

Access denied when trying to delete a file in Temporary ASP.NET Files folder

I am unable to run a web application after a build in VS 2013. I get the following error:
Access to the path 'C:\Users\Thelonius\AppData\Local\Temp\Temporary
ASP.NET Files\vs\3874c594\43dbfd8b\DotNetOpenAuth.OpenId.dll' is
denied.
I tried to delete the DLL using Windows Explorer directly, but I was met with the following dialog:
You require permission from the computer's administrator to make
changes to this file DotNetOpenAuth.OpenId.dll
I found it odd since I was running as the administrator. When I tried to change the permissions from the Security Tab in Explorer, I got the following message:
You must have Read permissions to view the properties of this object.
I am unable to change the ownership on the project. Is there a solution to this problem or should I just make another ASP.NET temporary file folder? This is strange. If it helps, I am running Windows 10.
For what it's worth, Windows Handle utility claims that VS 2013 has the file open, but why can't it delete it? Also, if the file is open by Visual Studio 2012, shouldn't the error message say that the file is open?
To been able to clear the Temporary asp.net directory you need to :
Stop the IIS service (or just stop the web site that you wish to clear)
Close all visual studio programs (or only the web site that you work with)

Classic ASP suddenly giving me permissions (401.3) error

Background: I support a classic ASP environment. I have a development setup locally on my machine as part of that support. I am running IIS7.
To access my environment, I use "http://localhost:99999/" (port # faked for privacy purposes). I have not had a problem with this -- until today.
I built an application that is intended to run in this environment. The app is ASP.NET v.4.0 (for sake of example, I'll say it's called "http://localhost:99999/DotNetApp/"). Of course, in order to run this, I had to set up my environment application pool to support it (which it now does).
Problem: after configuring this, I am now getting:
Server Error in '/' Application.
Access is denied.
Description: An error occurred while accessing the resources required to serve this request. You might not have permission to view the requested resources.
Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to '[filepath]\SourceFiles'.
I did NOT get this before I set my IIS configuration. Why am I getting this now?
Note: this ONLY happens with "http://localhost:99999/"; this does NOT happen if I try "http://localhost:99999/default.asp" (the page comes up with no problem).
Anyone have any insight?
Thanks in advance . . .
Edit: Additional symptoms: I tried playing with the application pool settings. The problem goes away if I change the .NET Framework version to either 2.0.50727 or to "No Managed Code." Changing it to 4.0.31319 breaks it. Of course, if I use any of the other two versions, my ASP.NET app won't run.
Edit #2: This problem occurs on ALL links that go to a folder or directory (e.g. "http://localhost:99999/somefolder/"), not just the web root.
Edit #3: I have a workaround: set "http://localhost:99999/" and "http://localhost:99999/DotNetApp/" in separate application pools. The first runs in .NET 2.0, while the latter runs .NET 4.0. (I'll post this as an answer once my 8 hour limit is up.) Probably not the best answer -- I'd prefer something that isn't as much of a kludge -- but for the time being, it'll get the job done. However, if anyone has a solution that enables me to run everything in the same app pool, by all means, post away!
You probably must specify "default.asp" as allowed in your "Default Document" settings in IIS7
EDIT: Check if ASP has been installed: Control Panel -> Programs and features -> Windows Features -> Internet Information Services -> Www services ->Application Development Features-> ASP
EDIT Final solution: The IUSR account is missing from the folder the website is in.
Set the default page for your site in IIS.
Try to set permission "Everyone" for directory "[filepath]\SourceFiles/" or/and "Allow" for other user names and groups in folder properties.

asp.net SQL Database File Error

We're getting the following error when trying to establish a connection to a database file in the project:
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
Any ideas on how we can fix it?
Thanks in advance!
http://jeremywadsworth.com/Default.aspx?blogentryid=56 has one possible fix.
http://forums.asp.net/t/1377174.aspx also has further discussion on the topic.
Hope that helps.
--
One more idea. I think I've encountered something like this when using Visual studio to create and access my database. You can detach your database file from visual studio and then directly attach it to your SQL server. I can't remember if the problem manifested in the same way or not but this should get you around the user instance issue. If this doesn't apply let me know and I'll see if i can come up with anything else.
If you are using IIS as the server,then this occurs because the server takes default asp.net database.
In IIS server,create your own application pool and run your app on that instead of using the default pool.
Check the permissions.Give full access control rights.
Also,
go to SQL server configuration>properties. Select local system in the built-in app.. And your new pool should also have local system selected.
This fixed the problem for me. Hope it works for someone here.
PS: If you are trying to making connectivity in Visual studio for android application,then close the visual studio before running it on android as the process wont complete if visual studio is open and will result into error.
SQL Express file attach starts a new 'user instance' SQL Server. This involves a new master/model/msdb/tempdb set of files that are created in the user settings data folder. also the startup of the new 'user instance' can take up to several minutes on extreme cases.
This MSDN article on SQL Server 2005 Express Edition User Instances cover in detail the process and luckly it has some Common Issues and fixes. The most common failure is due to access rights over the user settings copied files. You will usualy get details about the failure in your NT event log (ie. why did the child instance not start).
We got over this by copying the database from my machine to my team-mate's.

ASPNET user does not have write access to Temporary ASP.NET Files

I get the following error when running my Visual Studio 2008 ASP.NET project (start without Debugging) on my XP Professional box:
System.Web.HttpException: The current identity (machinename\ASPNET) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.
How can I resolve this?
Have you tried, the aspnet_regiis exe in the framework folder?
I had the same problem. This is what I did:
Go to c:\windows\microsoft.net\framework\v2.0.50727
right click on "Temporary ASP.NET files"
Security tab
Select "Users(xxxxxx\Users) from Group
check "Write"
OK
Either grant that user the level of access to that directory, or change the identity that the application's application pool runs under - in IIS Manager, determine what App Pool is used to run your application, then in the App Pool section of IIS Manager, look at the properties for that pool - the tab you want is "Identity" I think (this is off the top of my head).
You can set it to another user account - for example, Crystal Reports .Net requires update and delete access to C:\Temp - so we have a "webmaster" user, with administrator access, and use that identity for those applications.
You can try to fix it using the automated regiis utility aspnet_regiis.ext available in c:\windows\microsoft.net\framework\v2.0.50727
Otherwise just manually add the needed file permissions as noted in the error.
you can right click the Visual Studio & select run as administrator.
I had this problem when trying to build a Web Deployment Project (*.wdploy).
Simply creating the folder on the framework path solved the error.
Just because the most recent answer is 5 years old, what had to be done in our environment was to delete the app, app pool and recreate them.
We evidently have some security under the hood with recent changes to it.
Doing this re-created a folder in Temporary ASP Net Files with all the correct permissions. Why the one site I happened to just get from source control, rebuild, etc. failed this way, no idea. 2 others recently set up where Get Latest Version was downloaded, rebuilt, etc. they just worked.
But ripping out the app, app pool and just recreating them with the same IIS permissions as the 2 other known working sites recreated all the needed objects and now it all works.
Make sure the ASPNET user has permission to write to that folder. Right click on the folder, Properties, Security tab.

Resources