[英]How to enable remote debugging in Azure Cloud Service package built by MSBuild
我正在通過MSBuild(在TeamCity中)直接構建ccproj
項目:
msbuild Project.Azure.ccproj /p:Configuration=Debug /t:Publish
如何啟用遠程調試器? 就像在UI中一樣:
我不認為它可用作命令行開關。 我做了一些搜索,只在這里找到了你的問題。
如果我在VS 2013 Update 1中進行發布,啟用調試,它會在輸出目錄中創建一個臨時的.cscfg文件以及要上載的包(現在幾乎是原來的兩倍)。 .cscfg文件包含一些額外的設置:
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector.Version" value="2.3" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.ClientThumbprint" value="XXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.ServerThumbprint" value="XXXX" />
其中XXXX是由VS創建的證書的指紋,並安裝在證書存儲區(我的本地)中,其友好名稱為RemoteDebuggerZZZZZ。
更新的.csdef文件包含以下針對我的webrole的部分:
<Endpoints>
<InputEndpoint name="HttpIn" protocol="http" port="80" localPort="80" />
<InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="https" localPort="443" />
<InstanceInputEndpoint name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector" localPort="30398" protocol="tcp">
<AllocatePublicPortFrom>
<FixedPortRange min="30400" max="30424" />
</AllocatePublicPortFrom>
</InstanceInputEndpoint>
<InstanceInputEndpoint name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Forwarder" localPort="31398" protocol="tcp">
<AllocatePublicPortFrom>
<FixedPortRange min="31400" max="31424" />
</AllocatePublicPortFrom>
</InstanceInputEndpoint>
</Endpoints>
而對於我的工人角色:
<Endpoints>
<InstanceInputEndpoint name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector" localPort="30398" protocol="tcp">
<AllocatePublicPortFrom>
<FixedPortRange min="30425" max="30449" />
</AllocatePublicPortFrom>
</InstanceInputEndpoint>
<InstanceInputEndpoint name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Forwarder" localPort="31398" protocol="tcp">
<AllocatePublicPortFrom>
<FixedPortRange min="31425" max="31449" />
</AllocatePublicPortFrom>
</InstanceInputEndpoint>
</Endpoints>
它還為我的worker角色添加了一個證書部分:
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.TransportValidation" storeLocation="LocalMachine" storeName="My" />
</Certificates>
..並為我的網絡角色添加了相同的證書:
<Certificates>
<Certificate name="https" storeLocation="LocalMachine" storeName="My" />
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.TransportValidation" storeLocation="LocalMachine" storeName="My" />
</Certificates>
我手動添加了“https”證書,所以之前就是這樣。
似乎VS中的工具創建了一系列端口來訪問遠程調試工具使用的端口30398和31398,並將“TransportValidation”證書添加到證書列表中。
沒有為任一角色類型添加額外設置或導入。
我還沒有找到關於此的一些文檔,所以如果有人能說清楚,請做!
希望這有助於其他人嘗試這一點。
我們已經能夠為每個環境的Azure項目創建不同的配置文件。 然后我們傳入這個:
/p:TargetProfile=Dev
這樣,它就可以使用正確的Cloud Service配置文件構建。
除此之外,我知道我最終只會編寫一些一次性的C#甚至是Powershell腳本來修改構建后的配置。
Azure文檔中對此進行了解釋。
基本上你應該為visual studio 2013獲取遠程工具 ,然后將以下屬性添加到msbuild命令:
msbuild /TARGET:PUBLISH /PROPERTY:Configuration=Debug;EnableRemoteDebugger=true;VSX64RemoteDebuggerPath="<path-to-remote-tools>";RemoteDebuggerConnectorCertificateThumbprint="<thumbprint-of-ceritificate-that-is-added-to-the-cloud-service>";RemoteDebuggerConnectorVersion="2.4" "<path-to-solution-file>"
其中VSX64RemoteDebuggerPath
是Visual Studio遠程工具中包含`msvsmon.exe的文件夾的路徑
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.