2

我是一個完整的新手,當涉及到Azure開發(或者真的,任何與Windows和.Net有關的事情)時,請耐心等待...從網絡共享運行(本地)Azure工作者角色


我不使用Windows日常工作,所以在這個項目中,我設置了一個Windows 7 VirtualBox實例來進行開發。我有我的主機操作系統的代碼目錄與虛擬機共享,並且虛擬機已將其作爲網絡共享裝載(顯示爲E:\\\VBOXSVR\,具體取決於...?)。

我遇到的問題是,當我試圖讓我的工作人員角色在Azure計算仿真器將其與下面的錯誤死亡運行:

Microsoft.WindowsAzure.ServiceRuntime Critical: 201 : Role entrypoint could not be created: 
System.IO.FileLoadException: Could not load file or assembly 'file://\\VBOXSVR\XXX\YYY\csx\Debug\roles\WorkerRole\approot\WorkerRole.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) 
File name: 'file://\\VBOXSVR\XXX\YYY\csx\Debug\roles\WorkerRole\approot\WorkerRole.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information. 
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
    at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) 
    at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) 
    at System.Reflection.Assembly.LoadFrom(String assemblyFile) 
    at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum) 
    at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum) 

that link爲您提供了一個頁面,說:添加:

<loadFromRemoteSources enabled="true" /> 

到您的配置文件。我把它添加到輔助角色的app.config中,留給我:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <runtime> 
     <loadFromRemoteSources enabled="true"/> 
    </runtime> 
    ... 
</configuration> 

,但是,當我嘗試運行它,我得到同樣的錯誤消息。

+0

差不多一年後,我在VS2012上也有這種情況。同樣的問題:解決這個問題的正確方法是什麼? – 2012-11-28 22:58:53

回答

-1

我沒有在虛擬機上運行Azure項目,但在主機上運行源代碼。但據我所知,azure本地模擬器需要管理員權限。這可能是我猜測的原因,因爲我試圖從虛擬機調試主機上的應用程序,該虛擬機只是在VS中的共享文件夾中打開解決方案,但失敗了。

+0

我已經安裝了Azure虛擬機... Visual Studio強制您以管理員權限運行,以便能夠啓動它。 – 2012-01-31 06:17:51

+0

是的,我知道。您必須以管理員身份運行以運行天藍色的本地emu。但我有經驗,通過VM上的共享文件夾打開我的源代碼並進行調試,失敗。這就是爲什麼我想你沒有足夠的權限來開發虛擬機,不僅僅是爲了天藍色的項目。 – 2012-01-31 07:43:39