gpt4 book ai didi

.net - 从网络共享运行(本地)Azure 辅助角色

转载 作者:行者123 更新时间:2023-12-03 00:35:22 25 4
gpt4 key购买 nike

对于 Azure 开发(或者实际上,与 Windows 和 .Net 有关的任何事情),我完全是新手,所以请耐心等待...

<小时/>

我并不日常使用 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>

但是,当我尝试运行它时,我收到相同的错误消息。

最佳答案

我没有在虚拟机上运行我的 Azure 项目,而是在主机上运行源代码。但据我所知, azure 的本地模拟器需要管理员权限。这可能是我猜测的原因,因为我尝试从虚拟机调试主机上的应用程序,该应用程序只是在 VS 中的共享文件夹中打开解决方案,但失败了。

关于.net - 从网络共享运行(本地)Azure 辅助角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9068196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com