简体   繁体   English

从Windows Azure VM获取代码

[英]Getting code from Windows Azure VM

OK, so my hard disk just crashed. 好的,所以我的硬盘崩溃了。 Big deal. 大事了 All my web dev code that was on it went along with it, and now I'm running ddrescue on Ubuntu trying to recover whatever data I can recover. 我上面所有的Web开发代码都随之而来 ,现在我在Ubuntu上运行ddrescue ,试图恢复可以恢复的所有数据。 The hard disk keeps disconnecting and sometimes it can quit responding for a long time so it's really a pain in the ass. 硬盘一直处于断开状态,有时它可能会长时间停止响应,因此这实在是很痛苦的事情。

Anyway, back to the main topic--I have my web dev code which was packaged and uploaded to Azure; 无论如何,回到主要主题-我有打包并上传到Azure的Web开发代码; now what I'm wondering is if it's possible to obtain all my .cs files from the VM. 现在我想知道的是,是否有可能从VM中获取我的所有.cs文件。 I noticed approot and siteroot folders, but all I saw were the views, the .asax file, some other misc, stuff, nothing with the .cs extension. 我注意到approot和siteroot文件夹,但是我看到的只是视图,.asax文件,一些其他杂项,东西,而扩展名为.cs的内容却没有。

Is there any way I can get a copy of the code I packaged? 有什么方法可以获取打包的代码的副本? or (as a last resort) any way to get the .cspkg file and work from there? 或者(作为最后的手段)以任何方式获取.cspkg文件并从那里工作?

The site you are seeing on the web role and inside the cspkg file is the output of the compile, so you can't get the original .cs files out of them. 您在Web角色上看到的站点以及cspkg文件中的站点是编译的输出,因此您无法从中获取原始的.cs文件。 That said, you can use a tool like Reflector, Just Decompile, or a variety of other decompilers out there to reverse engineer your compiled bits into something that will be very close to the original C# code (not I'm assuming this is your own code, or code that doesn't have a provision against reverse engineering). 也就是说,您可以使用Reflector,Just Decompile或其他各种反编译器之类的工具将经过编译的位进行反向工程,使其与原始C#代码非常接近(不是我假设这是您自己的)代码或没有针对逆向工程的规定的代码)。 This at least will let you use the bits on the webrole to get the majority of your code back, then review it to see how good a job it did. 至少这将使您能够使用webrole上的位取回大部分代码,然后对其进行检查以查看其性能如何。

Note, you can open the cspkg file. 注意,您可以打开cspkg文件。 It's just a zip file. 这只是一个zip文件。 You can rename with a .zip file extension and open it up, but you won't find the .cs files in there. 您可以使用.zip文件扩展名重命名并打开它,但在那里找不到.cs文件。 The only time you find this to be the case is if you have multiple websites within a single web role. 唯一的情况是,一个Web角色中有多个网站。 The default packager for Windows Azure doesn't compile the additional sites, only packages up all the files in their root directory. Windows Azure的默认打包程序不会编译其他站点,而只会打包其根目录中的所有文件。 Not at all helpful for actual deployments really, but this won't likely help you. 确实对实际部署完全没有帮助,但这可能对您没有帮助。

You are likely well ahead of me on this, but I'd recommend using a personal source control system of some sort to avoid this issue in the future. 您可能在这方面遥遥领先于我,但我建议您使用某种类型的个人源代码控制系统,以避免将来再出现此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM