wales wales - 1 year ago 74
ASP.NET (C#) Question

web.config comments included in line error?

I'm troubleshooting an app, and I have this error to work with:

Exception message: Could not load file or assembly 'This.File,
Version=1, Culture=neutral, PublicKeyToken=[sometoken]' or one of its
dependencies. Access is denied. (C:\Program Files[file
location]\web.config line 205

Now - is that exactly line 205 of the web.config file, or is that line 205 if all the comments and empty lines from the web.config are removed?

I've tried researching this but find it very tricky!

Thank you!

Answer Source

This error means that there is an assembly referenced in the web.config that the compiler cannot locate. There are tactics to troubleshoot this. First, if you have the DLL make sure it is referenced by your project.

If it is a library located some where on your test machine, you can use this tool from the .NET Framework SDK - Assembly Binding Log Viewer This tool will tell you where .NET is looking when its trying to find your assembly.

If you want to load the assembly dynamically at run time, you can catch this error in code by handling the AssemblyResolve event on the current AppDomain:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download