2016-01-21 55 views
1

我正在向Azure Cloud Service項目添加簡單的啓動任務。該腳本確保Cloud Service在服務器上不超時(請參閱link)。當我將任務添加到我的ServiceDefinition.csdef文件時,我的項目無法運行;它永遠掛起並在VS的狀態欄中顯示「在Microsoft Azure計算模擬器中啓動應用程序的角色......」。這裏是我的ServiceDefinition.csdef中:在Azure Cloud Service中添加啓動任務不會在本地運行

<?xml version="1.0" encoding="utf-8"?> 
<ServiceDefinition name="DryrunCloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6"> 
    <WebRole name="MyCloud" vmsize="Small"> 
    <Startup> 
    <Task commandLine="Startup.cmd" executionContext="limited" taskType="simple"></Task> 
</Startup> 
<Sites> 
... 

的STARTUP.CMD文件(位於Web角色項目的bin文件夾):

REM *** Prevent the IIS app pools from shutting down due to being idle. 
%windir%\system32\inetsrv\appcmd set config -section:applicationPools - applicationPoolDefaults.processModel.idleTimeout:00:00:00 

REM *** Prevent IIS app pool recycles from recycling on the default schedule of 1740 minutes (29 hours). 
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.time:00:00:00 

任何想法?

+1

這只是一個在模擬器中運行的問題嗎?如果是這樣 - 您可以將啓動任務配置爲僅在雲中運行:https://azure.microsoft.com/en-us/documentation/articles/cloud-services-startup-tasks-common/#differentiate-between-磨合最模擬器和的雲 –

回答

1

This鏈接最終幫助了我。當你在VS中創建cmd文件時,出於某種原因它不起作用。您必須在解決方案之外創建它,然後將其添加到您的項目中。

相關問題