As suggested by these answers on Stack Overflow, I've added an app.config
file to my web role in order to have some binding redirects available during the call of Role.OnStart
in process WaIISHost.exe
.
The trick works under the compute emulator, but when I deploy the hosted service on Azure I've got exceptions on role start -- namely the same System.IO.FileLoadException
I would get on compute emulator if I omit the app.config
file.
I'm using Visual Studio 2010 and Azure SDK 1.8. The solution is built with .NET 4.0 and I've got several cloud projects for different purposes (debugging, production, ...).
I've analyzed the .cspkg
file created by Visual Studio and I've discovered that in the bin
folder of the web role there was no .config
file (as the linked answers suggested).
I then renamed the app.config
file in the project to match the assembly name and I've set its Copy local
property to true
-- this way I've been able to successfully deploy my hosted service.
I don't know if this behavior is triggered by the presence of multiple cloud projects in the solution.