对于Azure开发(或者真的,与Windows和.Net有关的任何事情),我是一个完全新手,所以请耐心等待...
我不是日常使用Windows,所以对于这个项目我设置了一个Windows 7 VirtualBox实例来进行开发。我将主机操作系统的代码目录与VM共享,并且VM将其作为网络共享挂载(根据......显示为E:\
或\\VBOXSVR\
)。
我遇到的问题是,当我尝试让我的worker角色在Azure Compute Emulator上运行时,它会因以下错误而死:
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" />
到你的配置文件。我将它添加到了worker角色的app.config中,留给我:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
...
</configuration>
但是,当我尝试运行它时,我收到相同的错误消息。
答案 0 :(得分:-1)
我没有在VM上运行我的Azure项目,而是在主机上运行源代码。但据我所知,azure本地模拟器需要管理员权限。这可能是我猜的原因,因为我尝试从VM调试主机上的应用程序,只是在VS中的共享文件夹上打开解决方案,但是失败了。