我在ASP.net MVC4中开发了一个小型webapp,框架版本为4.5.在使用Visual Studio 2015进行调试时,这一切都像是一个魅力.但是我没有 Windows服务器,而是 Linux(Ubuntu 14.04 VPS),我希望在那里部署. 我有最新
我有最新的mono和mod_mono与apache2一起运行.它似乎应该执行,但我得到一些错误.
我通过添加< customError mode =“off”>解决了第一个问题.也看到错误,然后添加单声道/寄存器文件夹.
但我现在被这个错误困扰了:
System.Security.SecurityException Couldn't impersonate token. Description: HTTP 500.Error processing request. Details: Non-web exception. Exception origin (name of application or object): mscorlib. Exception stack trace: at System.Security.Principal.WindowsImpersonationContext..ctor (IntPtr token) <0x41ef9dd0 + 0x0006f> in <filename unknown>:0 at System.Security.Principal.WindowsIdentity.Impersonate (IntPtr userToken) <0x41ef9d50 + 0x0003c> in <filename unknown>:0 at System.CodeDom.Compiler.Executor.ExecWaitWithCapture (IntPtr userToken, System.String cmd, System.String currentDir, System.CodeDom.Compiler.TempFileCollection tempFiles, System.String& outputName, System.String& errorName) <0x41ef9c90 + 0x00038> in <filename unknown>:0 at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.Compile (System.CodeDom.Compiler.CompilerParameters options, System.String compilerFullPath, System.String arguments, System.String& outputFile, System.Int32& nativeReturnValue) <0x41ef9a10 + 0x0010b> in <filename unknown>:0 at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) <0x41ef5c40 + 0x005fb> in <filename unknown>:0 at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) <0x41ef5aa0 + 0x000c7> in <filename unknown>:0 at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) <0x41ef58f0 + 0x0004d> in <filename unknown>:0 at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) <0x41ee0a70 + 0x00991> in <filename unknown>:0 at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) <0x41ee0a30 + 0x00023> in <filename unknown>:0 at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Web.Compilation.BuildProviderGroup group, System.Web.VirtualPath vp, Boolean debug) <0x41ed6b10 + 0x009b7> in <filename unknown>:0 at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath vp, Boolean debug) <0x41eac440 + 0x00523> in <filename unknown>:0 at System.Web.Compilation.BuildManager.Build (System.Web.VirtualPath vp) <0x41eabbc0 + 0x0011b> in <filename unknown>:0 at System.Web.Compilation.BuildManager.GetCompiledType (System.Web.VirtualPath virtualPath) <0x41eaaa70 + 0x00093> in <filename unknown>:0 at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) <0x41eaa690 + 0x00017> in <filename unknown>:0 at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) <0x41e9c4a0 + 0x0041b> in <filename unknown>:0
我无法修复该错误.我尝试了以下步骤:
>将项目发布到本地文件夹并将其复制到我的Linux
>服务器采取整个项目并添加到Linux服务器构建
>使用xbuild在Linux上运行整个项目
这都给出了相同的运行时错误.
我使用Travis CI来检查我的代码并通过了以下配置:
language: CSharp solution: BannedFromHighsec.sln script: - nuget restore BannedFromHighsec.sln - xbuild /p:Configuration=Release /target:BannedFromHighsec BannedFromHighsec.sln /p:TargetFrameworkVersion="v4.5" /p:DebugSymbols=False
Travis CI日志的粘贴素:http://pastebin.com/5s6p97i3
所以我有点想到这是我的代码有问题.但我不确定它是什么,因为它是一个简单的应用程序.使用SQlite进行基本的CRUD操作,并从API和第二个数据库中提取数据.我没有使用登录或任何东西.
我希望有人可以帮助我,我开始掌握asp.net MVC,并且想知道如果可能的话,如何在linux上部署它.