[英]Resolving Implement IMultiInstancePlugin after Nuget reinstall
Using .Net 4.6.2. 使用.Net 4.6.2。
I loaded an old project from source control to add a new images page. 我从源代码管理加载了一个旧项目,以添加新图像页面。
Image pages are kept in their respective folders, so I simply copied the functionality of "folder2015" to "folder2016" and ran the same code: 图像页面保存在各自的文件夹中,因此我仅将“ folder2015”的功能复制到“ folder2016”并运行相同的代码:
private void DisplayImages(string path) {
var dir = new DirectoryInfo(path);
var files = dir.GetFiles("DSC*.JPG");
var sb = new StringBuilder("<table>");
var td_counter = 0;
for (int n = 0; n < files.Length; n++) {
var file = files[n];
var ext = file.Extension.ToLower();
var lc_name = file.Name.Substring(0, file.Name.ToLower().IndexOf(ext));
if (lc_name.IndexOf("_s") == -1) {
var thumb = String.Format("{0}_s{1}.ashx?w=240&h=240", lc_name, ext);
if (td_counter == 0) {
sb.Append("<tr>");
}
sb.Append(String.Format("<td><a href=\"{0}\" target=\"_blank\"><img src=\"{1}\"></a></td>", file.Name, thumb));
td_counter++;
if (td_counter == 3) {
td_counter = 0;
sb.AppendLine("</tr>");
}
}
}
sb.AppendLine("</table>");
divDefault.InnerHtml = sb.ToString();
}
Each of the DSC*.JPG
images is between 6-8 MB. 每个DSC*.JPG
图像在6-8 MB之间。
The page would load, but all of the images were not available. 页面将加载,但是所有图像都不可用。
I saw ImageResizer
entries in the Web.config file, so decided the packages needed to be run on this PC. 我在Web.config文件中看到了ImageResizer
条目,因此决定了需要在此PC上运行的程序包。
I entered Package Manager Console to to get the latest: 我进入软件包管理器控制台以获取最新信息:
PM> Install-Package ImageResizer.MvcWebConfig PM>安装包ImageResizer.MvcWebConfig
PM> Install-Package ImageResizer.Plugins.DiskCache PM>安装包ImageResizer.Plugins.DiskCache
PM> Install-Package ImageResizer.Plugins.PrettyGifs PM>安装包ImageResizer.Plugins.PrettyGifs
I still did not see the images, so I debugged and found that I needed to look into the resizer.debug.ashx file. 我仍然没有看到图像,因此我进行了调试,发现需要查看resizer.debug.ashx文件。
The first error I saw staring at me there was: 我看到的第一个错误是:
Plugins(ConfigurationError): An instance of the specified plugin (ImageResizer.Plugins.Basic.MvcRoutingShimPlugin) has already been added. Plugins(ConfigurationError):已添加指定插件(ImageResizer.Plugins.Basic.MvcRoutingShimPlugin)的实例。 Implement IMultiInstancePlugin if the plugin supports multiple instances. 如果插件支持多个实例,则实现IMultiInstancePlugin。
The full resizer.debug.ashx file is on Paste Bin: http://pastebin.com/iVT6QJS5 完整的resizer.debug.ashx文件位于Paste Bin上: http : //pastebin.com/iVT6QJS5
How do I remove these duplicates? 如何删除这些重复项? Do I need to tell Nuget to uninstall first? 我需要告诉Nuget首先卸载吗? Do I need to reboot or restart VS between Nuget remove and Nuget install? 我需要在Nuget remove和Nuget install之间重新启动或重新启动VS吗?
Remove <add name="MvcRoutingShim" />
, as it's loaded by default already - your configuration is trying to load another instance. 删除<add name="MvcRoutingShim" />
,因为它已默认加载-您的配置正在尝试加载另一个实例。
It doesn't look like the Install-Package for DiskCache and PrettyGifs worked, though, as those .dlls cannot be found 不过,由于找不到这些.dll,因此看上去似乎无法为DiskCache和PrettyGifs安装软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.