Dattatray deshmukh
Dattatray deshmukh

Reputation: 39

System.ComponentModel.Win32Exception: Access is denied..... Error

I want to open one document file on our website. For that I write following code.

try
{
      Process proc = new Process();
      proc.StartInfo = new ProcessStartInfo(Server.MapPath("~/Quatation/PREMIUMQUOTATION1.doc"));
      proc.Start();
}
catch (WebException we)
{

}

It runs locally very fine but web on web server it gives me an error like

System.ComponentModel.Win32Exception: Access is denied?

Please suggest, what should I do?

Upvotes: 3

Views: 66721

Answers (8)

Swap
Swap

Reputation: 15

I am using .Net 4.5.2 and IIS 8.5.9

In IIS Manage->Pool Application->Advance Setting->Identity change ApplicationPoolIdentity to Custom Account and set Administrator User

Upvotes: 0

Karanrajsinh Jadeja
Karanrajsinh Jadeja

Reputation: 5

If you are getting this exception maybe you don't have the administration rights to your system so check with your admin and ask for the rights. If you do have administrator rights please open your IDE(e.g Visual Studio as an Administrator).You might also get this exception if you are trying to access the processes of 32 bit configuration system but your system has 64 bit configuration.

Upvotes: 0

ashkufaraz
ashkufaraz

Reputation: 5297

My problem solve with this

In IIS Manage->Pool Application->Advance Setting->Identity change to Custom Account and set Administrator User

Upvotes: 2

Pankaj Shivalkar
Pankaj Shivalkar

Reputation: 17

I faced the same issue while running my website from local IIS, after spending some time reading the project properties, found that, certain changes to the project properties were not saved...

Once it was saved, the error went away...

I got this error while I was working in visual studio 2017, using dotNet framework 4.5, in MVC project...

Upvotes: 0

Hamid Jolany
Hamid Jolany

Reputation: 880

may be your SQL server is off check it in services and start it

Upvotes: 2

Brendan L
Brendan L

Reputation: 1466

I had this problem when my .NET Target Framework was set to 4.5.2. I fixed it by changing the target framework version to 4.5. To do this using Visual Studio 2015, open Solution Explorer, right click on your solution and click Properties. The "Target Framework" should be set to ".NET Framework 4.5". Additionally, if you previously built with a target framework other than 4.5, you may have a <compiler> section in your web.config, and this may throw an error when you build. Just remove this section to fix the issue. Removing it should not cause any problems.

I wrote a short article about this here that has a couple other things to try that didn't work for me but might work for you.

Also check out This Stack Overflow answer which also helped numerous people with this error!

Upvotes: 5

Rahul Nikate
Rahul Nikate

Reputation: 6337

It sounds like you haven't changed the service logon user. You can do it from service control manager by right clicking the service and go to the Logon tab. Then add user as Service Logon User

Or you can do it from the command line:

sc config ServiceName obj= Domain\user password= pass

Note the space between obj= and Domain\user it is not a typo. It is required. The same for password=.

Upvotes: 1

user2930590
user2930590

Reputation:

Goto windows explorer and right click on the folder "~/Quatation/". Select properties and pick the Security tab to give permissions. In the case where your application pool under which the web application runs is using a domain account, you will need to give that specific domain account permission.

Upvotes: 0

Related Questions