question

EspenJohannessen-5003 avatar image
0 Votes"
EspenJohannessen-5003 asked ·

"The specified user does not have a valid profile. Unable to load " when dynmically loading assembly

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?

azure-webapps-webjobs
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JeremyBrooks-4731 avatar image
1 Vote"
JeremyBrooks-4731 answered ·

I believe this is the configuration you are looking for that is configured through an app settings:

  • It needs to be explicitly turned on. This is done by setting an app setting called WEBSITE_LOAD_USER_PROFILE, with value 1

  • It is only available for sites running in Basic or Standard mode (i.e. which don't share their VM with others)

https://github.com/projectkudu/kudu/wiki/Configurable-settings#add-user-profile-support-for-a-site

· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @JeremyBrooks-4731, this solved my issue and saved me lot of time!

0 Votes 0 · ·
ajkuma-MSFT avatar image ajkuma-MSFT EspenJohannessen-7963 ·

@EspenJohannessen-7963, Glad to know that the solution provided by Jeremy helped. Thanks for the update. Please do mark the post which was helpful by clicking on ‘Accept Answer’ to help the community find the right answers.

1 Vote 1 · ·