问题
Problem
I am trying to deploy a worker role which will autoscale a few target sites. I am able to run the autoscaler locally and it works (I installed the certificates on my machine). However, it won't autoscale once I deploy it to Azure as a cloud app. (However, the worker role is running because I can see my non-autoscaling processes working in the same worker role.)
What I tried
I have followed the Deploying the Autoscaling Application Block instructions.
What am I missing?
Thanks
回答1:
Tuzo is right - cert should be in LocalMachine, but that's not enough. See this SO post. Basically, in OS Family 2, WaWorkerHost is running under a temporary account (with a GUID name) generated by Role initialization process, this account has permission to access certificate private key; In OS Family 3, WaWorkerHost is running under “NETWORK SERVICE” account, this account doesn’t have private key access permission.
Best option for now (MS Azure team addressing issue in next SDK) is to run the role with elevated privileges - edit ServiceDefinition.csdef:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="blah" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8">
<WorkerRole name="blah" vmsize="Small">
<Runtime executionContext="elevated" />
...
</WorkerRole>
</ServiceDefinition>
回答2:
For running in Azure I would try setting the Store Location to be LocalMachine.
If you've followed all the steps in the Deploying the Autoscaling Application Block then the certificate with the private key (.pfx) should be deployed in the role. You can RDP into the server to verify that the certificate is installed (and the location).
You can also try enabling logging as per Autoscaling Application Block Logging to see if there are any messages.
来源:https://stackoverflow.com/questions/14448689/azure-autoscaling-works-locally-but-not-when-deployed