I have a console app running .NET framework running as a web job.
A part of this job compiles some .cs-scripts at runtime, stores the compiled files in a directory, and loads them to invoke a method in the compiled script.
On local development environment and on standard windows server this works fine. But when running this on Azure as web job i get the error :
Error in method System.Reflection.RuntimeAssembly _nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean) of mscorlib.Message is: The specified user does not have a valid profile. Unable to load 'file:///D:\home\site\jobs\triggered\BatchJobManager\BatchJobScriptsCompiled\CleanLogTables.csc
It is the same console app that creates and tries to load the compiled script.
I have tried to run the script from the KUDU-console with power-shell command Start-Process with option -LoadUserProfile, I have tried making an separate console-app that invokes this console app using StartInfo.LoadUserProfile = true from the System.Diagnostics.Process class, and I have tried to figure out if I can set the LoadUserProfile parameter in Azure that resembles the one used on IIS for setting loadUserProfile = true without any luck.
Anyone that has been in a similair scenario with this error message on web jobs that might help me progress?