未处理的异常:System.TypeLoadException:无法从程序集'System.IO.FileSystem,Version = 4.0.2.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'加载类型'System.IO.Di rectory'。在fais.printing_services.Program.Main(String [] args)
我做过一些我能想到的伎俩,跟着所有最新的问题来解决,没有运气。这是我的项目文件:
{
"userSecretsId": "aspnet-fais.printing_services-6f6dbf21-da98-45d2-a187-08ae49d09d62",
"dependencies": {
"DataTables.AspNet.AspNetCore": "2.0.2",
"Microsoft.ApplicationInsights.AspNetCore": "2.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.1",
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNet.Session": "1.0.0-*",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.Relational.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",
"version": "1.1.0-preview4-final"
},
"Microsoft.Extensions.Caching.Memory": "1.1.0-*",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
"Microsoft.VisualStudio.Web.CodeGeneration": "1.1.0-preview4-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final",
//"Microsoft.VisualStudio.Web.CodeGeneration.Design": "1.1.0-msbuild3-final",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Session": "1.1.0",
"Microsoft.NETCore": "5.0.1-rc2-24027",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027",
"BundlerMinifier.Core": "2.4.337",
"Microsoft.AspNetCore.ResponseCompression": "1.0.1",
"Microsoft.AspNetCore.Cors": "1.1.1",
"hiqpdf": "10.6.0",
"Novell.Directory.Ldap.NETStandard": "2.3.6"
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.1.0-preview4-final",
"imports": [
"portable-net45+win8"
]
},
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0.0-preview4-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.1.0-msbuild3-final",
"imports": [
"portable-net45+win8"
]
}
},
"frameworks": {
"net461": {
"dependencies": {
},
"frameworkAssemblies": {
"System.Drawing": "4.0.0.0"
}
},
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8",
"net461"
],
"dependencies": {
"Microsoft.NETCore.App": "1.1.0",
"CoreCompat.System.Configuration": "4.2.3-r4"
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"runtimes": {
"win10-x64": {}
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
因此.net4.6.1
的原因是hiqpdf
,这是我唯一需要加载它的原因。
我的应用程序在IISExpress上运行,但只要我将其发布到IIS框,就会得到HTTP Error 502.5 - Process Failure
。我在命令提示符下运行exe,因为微软问我得到了什么。
我一直在想我只需要移动正确的项目,它就可以在服务器上运行。有什么不同?为什么它会在本地出色,但却落在服务器上?我可以在一个可以修复此问题的版本中包含System.IO.FileSystem吗? (我尝试过但都没有)。
我知道project.json文件需要再次清理,但它在一个地方工作,所以我想我会把它保留在这里。
服务器详细信息:
其他信息 我认为值得注意的是我已经完成的事情,不会从中得知:
System.IO.File
直接包含在v。4.3.0
中,但我相信它会降级为4.0.0.1
。我能够再次摆弄工作方式。对我很好,但我不会删除它。问题在于我的解决方案是将堆栈跳转到框架并关闭"Novell.Directory.Ldap.NETStandard": "2.3.6"
。这意味着我的旁路就是这样,我可以让老板们高兴他们有自己的POC,而不是投入生产。我更新了它,以便揭示新的领域。