2017-01-16 61 views
0

我正在嘗試使用來自NuGet的最新ImageResizer軟件包來更新我們的解決方案。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> 

回答

0

你可以在錯誤信息中看到,發生錯誤的PluginConfig.ParseName(String typeName) - 因爲這是一個空引用錯誤,這個強烈暗示名稱爲空。

看你配置的插件部分是那麼明顯,你有沒有爲logging插件指定一個名稱:

<add logging="true" /> 

documentation說,這是正確的語法:

<add name="Logging" /> 
相關問題