Home >Database >Mysql Tutorial >升级Azure SDK 2.5后总是调用WindowsAzure.ServiceRuntime.Defau

升级Azure SDK 2.5后总是调用WindowsAzure.ServiceRuntime.Defau

WBOY
WBOYOriginal
2016-06-07 15:44:161183browse

最近将一个Azure Work Role项目由Azure SDK2.4升级到了2.5。在升级完毕后,发现该Work Role项目无论是部署在本地的Azure emulator中还是Azure 生产环境上,都无法正常启动。在本地的Emulator中调试时,OnStart()中设置断点也无法走到,让人感觉非常费解,因

    最近将一个Azure Work Role项目由Azure SDK2.4 升级到了2.5。在升级完毕后,发现该Work Role项目无论是部署在本地的Azure emulator中还是Azure 生产环境上,都无法正常启动。在本地的Emulator中调试时,OnStart()中设置断点也无法走到,让人感觉非常费解,因为没有做过任何代码的修改,仅仅是升级了Azure SDK而已。在Visual Studio中的Output看到了如下的调试输出信息:


Microsoft.WindowsAzure.ServiceRuntime Information: 200 : Role entrypoint . CALLING   OnStart():Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 202 : Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
The thread 0x9210 has exited with code 259 (0x103).
Microsoft.WindowsAzure.ServiceRuntime Information: 203 : Role entrypoint . CALLING   Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Verbose: 500 : Role instance status check starting
Microsoft.WindowsAzure.ServiceRuntime Verbose: 502 : Role instance status check succeeded: Ready
Microsoft.WindowsAzure.ServiceRuntime Warning: 204 : Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 503 : Role instance recycling is starting
The thread 0xa100 has exited with code 259 (0x103).
Microsoft.WindowsAzure.ServiceRuntime Information: 205 : Role entrypoint . CALLING   OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 205 : Role entrypoint . CALLING   OnStopping()
Microsoft.WindowsAzure.ServiceRuntime Information: 206 : Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint


       不难看出,Azure emulator一直在调用ServiceRuntime中自带的DefaultEntryPoint,压根就没有执行到我程序中定义的继承于RoleEntryPoint的类。也就是,Azure emulator/Azure没有找到我的work role文件中定义的RoleEntryPoint。

       这是为啥呢? 仔细想想,原来为了抽象出RoleEntryPoint,我们特地在其上继承出另外一个类WorkRoleBase,并将它作为一个单独库项目,以便于其它类似WorkRole项目使用。但这个库项目仍然使用的是Azure SDK 2.4,再将它也升级到2.5之后,该Work Role就可成功部署了。所以,之前的出现的问题很有可能是因为同时引用到两个不同版本的的Azure SDK造成。


<pre class="brush:php;toolbar:false"><span>///</span><span> </span><span><summary></summary></span>
<span>///</span><span> Worker role project using Azure SDK 2.5</span>
<span>///</span><span> </span><span></span>
<span>public</span> <span>sealed</span> <span>class</span> <span>WorkerRole</span> : <span>WorkerRoleBase</span>
{
}


<pre class="brush:php;toolbar:false"><span>///</span><span> </span><span><summary></summary></span>
<span>///</span><span> Worker role library using Azure SDK 2.4</span>
<span>///</span><span> </span><span></span>
<span>public</span> <span>abstract</span> <span>class</span> <span>WorkerRoleBase</span> : <span>RoleEntryPoint</span>
{
}



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn