I try to publish a demo application to Windows Azure using Cloud Service and Azure SDK 2.9. In my service I have a Web Role and a Worker Role. Both use Azure Storage. Everything works fine on local hosting (Emulator) but when I try to publish the app I get the following error on Web Role:
Unhandled Exception: System.Runtime.Serialization.SerializationException,
Details: Exception: Unable to find assembly 'Microsoft.WindowsAzure.Storage, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf385)
In the Worker Role project everything is OK, it's using Storage too.
I tried to convert the Web Role to a standard Web Application and everything works fine but I want to resolve this problem on Cloud Application.
What I've tried:
On my VM I checked the bin folder, Microsoft.WindowsAzure.Storage exists.
Any ideas what is wrong?
After two days I found a solution for that problem. In my WebRole.cs I had this:
public override bool OnStart()
{
var csa = CloudStorageAccount.Parse(RoleEnvironment
.GetConfigurationSettingValue("Credentials"));
var cqc = csa.CreateCloudQueueClient();
var inputQueue = cqc.GetQueueReference("inputqueue");
inputQueue.CreateIfNotExists();
var outputQueue = cqc.GetQueueReference("outputqueue");
outputQueue.CreateIfNotExists();
var ctc = csa.CreateCloudTableClient();
var ct = ctc.GetTableReference("last");
ct.CreateIfNotExists();
return base.OnStart();
}
When I moved this initialization to other place e.g. to RouteConfig.cs everything works perfect. I don't know why but every references to Storage from WebRole throws errors after publishing to Azure. I hope this solution helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With