我想使用Powershell「Publish-AzureServiceProject」cmdlet發佈一個Node.js包到Azure。Publish-AzureServiceProject Node.js到Windows Server 2012
使用默認osFamily = 「2」(在Windows Server 2008 R2),它按預期工作,但是當我發佈使用osFamily = 「3」(Windows Server 2012中)我得到以下錯誤:
The feature named NetFx35 that is required by the uploaded package is not available in the OS * chosen for the deployment.
很明顯,我沒有使用.Net,但3.5是默認設置,可以阻止我上傳軟件包。
要指定.NET 4.5,我讀了,我需要創建一個包含roleproperties.txt文件:
TargetFrameWorkVersion=v4.5
,並通過A/rolePropertiesFile把它傳遞給cspack。
但是,由於我沒有自己調用cspack,我怎麼能通過Publish-AzureServiceProject將該選項傳遞給cspack?還是有另一種解決方法?
目前我的服務定義是這樣的:
<?xml version="1.0"?>
<ServiceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Foo" upgradeDomainCount="1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WorkerRole name="Bar">
<Imports>
<Import moduleName="RemoteForwarder" />
<Import moduleName="RemoteAccess" />
</Imports>
<Startup>
<Task commandLine="setup_worker.cmd > log.txt" executionContext="elevated">
<Environment>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
</Variable>
<Variable name="RUNTIMEID" value="node" />
<Variable name="RUNTIMEURL" value="http://nodertncu.blob.core.windows.net/node/0.6.20.exe" />
</Environment>
</Task>
</Startup>
<Endpoints>
<InputEndpoint name="HttpIn" protocol="tcp" port="80" />
</Endpoints>
<Runtime>
<Environment>
<Variable name="PORT">
<RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[@name='HttpIn']/@port" />
</Variable>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
</Variable>
</Environment>
<EntryPoint>
<ProgramEntryPoint commandLine="runnode.cmd" setReadyOnProcessStart="true" />
</EntryPoint>
</Runtime>
</WorkerRole>
</ServiceDefinition>
謝謝我實際上已經明白了這一點。我仍然缺少的是從命令行上傳軟件包的方法。這可能嗎? – laktak
是的,您可以使用new-AzureService上傳cspkg來創建不帶部署的服務,然後使用New-AzureDeployment爲您提供cspkg文件。 –
哎呀,回來了,並試圖再次upvote。這個信息是無價的,謝謝你的謝謝! –