我是一個完整的新手,當涉及到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>
,但是,當我嘗試運行它,我得到同樣的錯誤消息。
差不多一年後,我在VS2012上也有這種情況。同樣的問題:解決這個問題的正確方法是什麼? – 2012-11-28 22:58:53