簡體   English   中英

更新后,ImageResizer引發“對象引用未設置為對象的實例。”

[英]ImageResizer throws “Object reference not set to an instance of an object.” after update

我正在嘗試使用NuGet的最新ImageResizer軟件包更新我們的解決方案。

更新后,我得到了下面的空異常。 因此,我嘗試還原解決方案並再次更新軟件包。 同樣的問題。 我還嘗試使用ImageResizer中內置的診斷頁面,但這也有相同的問題。 NuGet更新期間沒有任何問題。

堆棧跟蹤:

[NullReferenceException: Object reference not set to an instance of an object.]
   ImageResizer.Configuration.PluginConfig.ParseName(String typeName) +8
   ImageResizer.Configuration.PluginConfig.FindPluginType(String searchNameString) +99
   ImageResizer.Configuration.PluginConfig.add_plugin_by_name(String name, NameValueCollection args) +16
   ImageResizer.Configuration.PluginConfig.loadPluginsInternal() +214
   ImageResizer.Configuration.PluginConfig.LoadPlugins() +93
   ImageResizer.Configuration.Config..ctor(ResizerSection config) +393
   ImageResizer.Configuration.Config.get_Current() +109
   ImageResizer.InterceptModule.System.Web.IHttpModule.Init(HttpApplication context) +276
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +536
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

web.config中的調整程序設置:

  <resizer>
    <plugins>  
      <add name="AzureReader2" prefix="~/cloud/" connectionString="DefaultEndpointsProtocol=https;AccountName=XXX;AccountKey=XXX" endpoint="https://XXX.windows.net/" />
      <add logging="true" />
      <add name="DiskCache" />
    </plugins>
    <clientcache minutes="60" />
    <diskcache enabled="true" dir="~/App_Data/DiskCache" AutoClean="true" hashModifiedDate="true" subfolders="32" cacheAccessTimeout="15000" asyncWrites="false" asyncBufferSize="10485760" />
    <cleanupStrategy startupDelay="00:05" minDelay="00:00:20" maxDelay="00:05" optimalWorkSegmentLength="00:00:04" targetItemsPerFolder="400" maximumItemsPerFolder="1000" avoidRemovalIfCreatedWithin="24:00" avoidRemovalIfUsedWithin="4.00:00" prohibitRemovalIfUsedWithin="00:05" prohibitRemovalIfCreatedWithin="00:10" />
  </resizer>

您可以在錯誤消息中看到該錯誤發生在PluginConfig.ParseName(String typeName) -由於這是一個空引用錯誤,因此強烈暗示該名稱為空。

查看配置的插件部分,很明顯您沒有為logging插件指定名稱:

<add logging="true" />

文檔說這是正確的語法:

<add name="Logging" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM