我怎样才能修复system.web.dll版本冲突?

时间:2023-01-06 07:00:34

I use RazorEngine V 3.0.8 in my project(Asp.net MVC 4) for parsing email template. I use system.web.dll version 1.0.0 in my project. Every thing is ok on my pc as local site and It works. but on server this error was shown:

我在我的项目(Asp.net MVC 4)中使用RazorEngine V 3.0.8来解析电子邮件模板。我在我的项目中使用system.web.dll版本1.0.0。我的电脑上的每件东西都可以作为本地网站使用。但在服务器上显示此错误:

Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

无法加载文件或程序集'System.Web.Razor,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。该系统找不到指定的文件。

but I didn't use 'System.Web.Razor, Version=2.0.0.0 on my project. also when I add 'System.Web.Razor, Version=2.0.0.0 to my project , I have problem for parsing email template with RazorEngine and this error was shown:

但我没有在我的项目中使用'System.Web.Razor,Version = 2.0.0.0。当我将'System.Web.Razor,Version = 2.0.0.0添加到我的项目中时,我遇到了使用RazorEngine解析电子邮件模板的问题,并显示了以下错误:

System.IO.FileLoadException: Could not load file or assembly 'System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at RazorEngine.Compilation.DefaultCompilerServiceFactory.CreateCompilerService(Language language) at RazorEngine.Templating.TemplateService.CreateTemplateType(String razorTemplate, Type modelType) at RazorEngine.Templating.TemplateService.CreateTemplate[T](String razorTemplate, T model) at RazorEngine.Templating.TemplateService.Parse[T](String razorTemplate, T model) at RazorEngine.Razor.Parse[T](String razorTemplate, T model) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at Service.Implementation.EmailService.InitializeTemplate(String templateBody, Object model) in c:\Badr\Service\Implementation\EmailService.cs:line 21 at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at Service.Implementation.EmailService.SendSingleEmail(String from, String name, String[] to, String subject, String templateBody, Object model, EmailSendMethod sendMethod) in c:\Badr\Service\Implementation\EmailService.cs:line 32 at CallSite.Target(Closure , CallSite , EmailService , String , String , String[] , String , String , Object , EmailSendMethod ) at System.Dynamic.UpdateDelegates.UpdateAndExecute8[T0,T1,T2,T3,T4,T5,T6,T7,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) at Service.Implementation.EmailService.SendSingleEmail(String from, String name, String to, String subject, String templateBody, Object model, EmailSendMethod sendMethod) in c:\Badr\Service\Implementation\EmailService.cs:line 27 at Service.Implementation.UserEmailService.SendLicenseToUser(Guid token) in c:\Badr\Service\Implementation\UserEmailService.cs:line 86 at Web.Controllers.PurchaseController.CreatePurchaseAndSendEmail(IEnumerable`1 cartItems) in c:\Badr\Web\Controllers\PurchaseController.cs:line 759

System.IO.FileLoadException:无法加载文件或程序集'System.Web.Razor,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (来自HRESULT的异常:0x80131040)文件名:RazorEngine.Templating.TemplateService的RazorEngine.Compilation.DefaultCompilerServiceFactory.CreateCompilerService(语言语言)中的文件名:'System.Web.Razor,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'。 RazorEngine.Razor.Parse中RazorEngine.Templating.Template.TemplateService.Parse [T](String razorTemplate,T model)的RazorEngine.Templating.TemplateService.CreateTemplate [T](String razorTemplate,T model)中的CreateTemplateType(String razorTemplate,Type modelType) Service.Implementation.EmailService.InitializeTemplate(String)中System.Dynamic.UpdateDelegates.UpdateAndExecute3 [T0,T1,T2,TRet](CallSite站点,T0 arg0,T1 arg1,T2 arg2)的[T](字符串razorTemplate,T模型) templateBody,Object model)在c:\ Badr \ Service \ Implementation \ EmailService.cs:第21行在System.Dynamic.UpdateDelegates.UpdateAndExecute3 [T0,T1,T2,TRet](CallSite站点,T0 arg0,T1 arg1,T2 arg2 )at Service.Implementation.EmailService.SendSingleEmail(String from ,String name,String [] to,String subject,String templateBody,Object model,EmailSendMethod sendMethod)位于c:\ Badr \ Service \ Implementation \ EmailService.cs:第32行,位于CallSite.Target(Closure,CallSite,EmailService,String, System.Dynamic.UpdateDelegates.UpdateAndExecute8 [T0,T1,T2,T3,T4,T5,T6,T7,TRet]中的String,String [],String,String,Object,EmailSendMethod)(CallSite站点,T0 arg0,T1 arg1 Service.Implementation.EmailService.SendSingleEmail(String from,String name,String to,String subject,String templateBody,Object model,EmailSendMethod sendMethod)in,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7)in c:\ Badr \ Service \ Implementation \ EmailService.cs:位于Service.Implementation.UserEmailService.SendLicenseToUser(Guid令牌)的第27行位于c:\ Badr \ Service \ Implementation \ UserEmailService.cs:第86行,位于Web.Controllers.PurchaseController。 c:\ Badr \ Web \ Controllers \ PurchaseController.cs中的CreatePurchaseAndSendEmail(IEnumerable`1 cartItems):第759行

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

警告:装配绑定日志记录已关闭。要启用程序集绑定失败日志记录,请将注册表值[HKLM \ Software \ Microsoft \ Fusion!EnableLog](DWORD)设置为1.注意:程序集绑定失败日志记录会导致一些性能损失。要关闭此功能,请删除注册表值[HKLM \ Software \ Microsoft \ Fusion!EnableLog]。

Please help me what should I do?

请帮帮我,我该怎么办?

1 个解决方案

#1


0  

I looked into your stack trace and looks like it trying to load System.Web.Razor, Version=1.0.0.0 not System.Web.Razor, Version=2.0.0.0 so please try to check references in Web.config files you can also try to deploy your site with System.Web.Razor.dll (select always copy) maybe this help

我查看了你的堆栈跟踪,看起来它试图加载System.Web.Razor,Version = 1.0.0.0而不是System.Web.Razor,Version = 2.0.0.0所以请尝试检查Web.config文件中的引用你也可以尝试使用System.Web.Razor.dll部署您的站点(选择始终复制)也许这个帮助

#1


0  

I looked into your stack trace and looks like it trying to load System.Web.Razor, Version=1.0.0.0 not System.Web.Razor, Version=2.0.0.0 so please try to check references in Web.config files you can also try to deploy your site with System.Web.Razor.dll (select always copy) maybe this help

我查看了你的堆栈跟踪,看起来它试图加载System.Web.Razor,Version = 1.0.0.0而不是System.Web.Razor,Version = 2.0.0.0所以请尝试检查Web.config文件中的引用你也可以尝试使用System.Web.Razor.dll部署您的站点(选择始终复制)也许这个帮助