我有一个基于 ASP.NET 5 RC1 final 预览模板的应用程序。我通过运行发布应用程序
dnu publish --no-source --runtime active --configuration Release
生成的包包含运行时“dnx-clr-win-x64.1.0.0-rc1-final”。
当我将包复制到另一台 Windows 机器并尝试在 output\approot 目录中运行 web 命令时,我收到以下错误:
Error: Unable to load application or execute command 'Microsoft.AspNet.Server.WebListener'. Available commands: web, webListener.
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.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at Microsoft.Dnx.Runtime.Loader.LoadContext.LoadFile(String assemblyPath)
at Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
at Microsoft.Dnx.Host.LoaderContainer.Load(AssemblyName assemblyName)
at Microsoft.Dnx.Runtime.Loader.AssemblyLoaderCache.GetOrAdd(AssemblyName name, Func`2 factory)
at Microsoft.Dnx.Runtime.Loader.LoadContext.ResolveAssembly(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
我已经尝试过 Kestrel 和 WebListener,同样的错误信息。该软件包适用于我的机器。
为了让应用程序在另一台机器上运行,还有什么需要做的吗?