【发布时间】:2020-04-04 11:18:39
【问题描述】:
我正在使用 ASP.net Core 3.0 并且我想要 html to pdf 导出功能,我发现 JSReport 作为解决方案所以我按照 JSReport .net SDK 的 Jon Blaha's Implementation 将 html 导出为 pdf,我已经成功安装nugets jsReport.Binary、jsReport.Local 和 jsReport.AspNetCore 在我的开发机器中。
以下是已安装的 dll
- jsReport.AspNetCore.dll (v2.0.2.0)
- jsReport.Client.dll (v3.0.1.0)
- jsReport.Local.dll (v2.2.2.0)
- jsReport.Shared.dll (v2.1.0.0)
- jsReport.Types.dll (v2.6.1.0)
- jsReport.Binary.dll (v2.7.1.0)
我遵循了 Jon Blaha 的实现,Export html to pdf 在我的开发机器上运行良好。但是当我使用项目发布的 dll 上传 dll 时,我的应用程序停止工作
启动应用程序时发生错误
我搜索了这个错误,发现我必须通过我的web.config 使用
stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"
获取启动失败背后的实际错误消息。
对我的web.config 进行必要的更改后,我生成了日志文件,它说
System.IO.FileNotFoundException:无法加载文件或程序集“jsreport.Local,版本=2.2.2.0,文化=中性,PublicKeyToken=null”。系统找不到指定的文件。
crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
Application startup exception
System.IO.FileNotFoundException: Could not load file or assembly 'jsreport.Local, Version=2.2.2.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'jsreport.Local, Version=2.2.2.0, Culture=neutral, PublicKeyToken=null'
at Technicianspk.Startup.ConfigureServices(IServiceCollection services)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass4_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
我使用 FileZilla 通过 FTP 仔细检查了我的 wwwroot 目录,我的服务器上有所有这些必需的 jsReport dll,但我仍然找不到文件。
我什至比较了 dll 版本,并确保我的 .csproj 文件引用了所有必需的 jsreport dll,但仍然无法找到 jsReport.Local.dll。
我的开发机器和服务器的 wwwroot 目录中有 jsReport.Local.dll,其中存在所有其他 dll,包括我的 project.dll 和 project.views.dll 和 project.exe 等。
我的cs.proj 文件也有以下内容
<ItemGroup>
<PackageReference Include="jsreport.AspNetCore" Version="2.0.2" />
<PackageReference Include="jsreport.Binary" Version="2.7.1" />
<PackageReference Include="jsreport.Client" Version="3.0.1" />
<PackageReference Include="jsreport.Local" Version="2.2.2" />
<PackageReference Include="jsreport.Shared" Version="2.1.0" />
<PackageReference Include="jsreport.Types" Version="2.6.1" />
</ItemGroup>
【问题讨论】:
标签: asp.net-core dll web-deployment filenotfoundexception jsreport