Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does System.Web.Hosting.ApplicationHost.CreateApplicationHost throw System.IO.FileNotFoundException?

Tags:

c#

I saw something about needing to have the assembly available for the type of the first argument passed to the function. I think it is, I can't figure out what am I missing.

This code is in a service. I was running the service under the 'NETWORK SERVICES' user account, when I changed the account to that of the session I was logged on with it worked ok. But, what's the difference, and how can I get it to work for the NETWORK SERVICES user.

like image 978
Scott Langham Avatar asked Oct 14 '22 17:10

Scott Langham


2 Answers

copy your binary to the bin folder of your web app will also fix this.

like image 88
Chocoboboy Avatar answered Oct 18 '22 15:10

Chocoboboy


By the way, this page has a little more information on this topic and a possible way to workaround the issue of GAC vs copying your assembly to the bin folder. The page is a few years old at this point but it still seems relevant.

like image 45
Jason Avatar answered Oct 18 '22 13:10

Jason