0

I have a site that uses a separate assembly for logging. This assembly will write to the event log any errors that are thrown in the code on my aspx page. For some reason I randomly (and I say randomly because I haven't found the exact steps to reproduce the error) get an error saying that access is denied:

Could not load file or assembly 'Logging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=49d029f85976040e' or one of its dependencies. Access is denied.

The assembly is referenced at the top of my aspx page:

<%@ Assembly Name="Logging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=49d029f85976040e" %>

If I restart IIS it will clear up the error. But it will eventually come back. So that is not an acceptable solution.

Any ideas?

PS I'm using ASP.net 2.0 running on windows server 2008 sp1 and IIS 7.

2
  • I need to make sure: it does work most of the time? You do see errors in the event log now and then? Commented Oct 5, 2009 at 19:50
  • 3
    Also: have you seen elmah? code.google.com/p/elmah Commented Oct 5, 2009 at 19:50

3 Answers 3

1

You can try not signing the assembly by doing something like this.

Sign up to request clarification or add additional context in comments.

Comments

0

I can't think of any cause for this kind of random error from my own experience. As a work-around, have you tried catching and logging errors in the Page_Error or Application_Error event instead? You would then be able to reference your logging assembly from the code-behind instead of the markup, and it would probably be more reliable.

Comments

0

Have you tried granting the IIS User full access to the C:\Windows\Microsoft.Net\Framework(64)\v(version)\Temporary ASP.NET Files folder?

I've gotten around similar issues by doing this. If you're not sure which user IIS is running under, just the 'Users' group access and see if it makes the problem go away.

(You might be incurring additional security risk here, but if this solves your problem you can look at ways to mitigate that..)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.