none
Enterprise Library Caching RRS feed

  • Question

  • Hi,

     

    I am getting an error "could not find file"  in th following line

    CacheManager cache = CacheFactory.GetCacheManager();

    But the same code is working in other system.

    Please help me on this.

    Please find the following error message.

     

    System.IO.FileNotFoundException was unhandled
      Message="Could not find file 'InboundLogistics\\-1208129235\\ScPr'."
      Source="mscorlib"
      FileName="InboundLogistics\\-1208129235\\ScPr"
      StackTrace:
           at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
           at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
           at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
           at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf)
           at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf)
           at Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageCacheItemField.Read(Boolean encrypted)
           at Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageCacheItem.Load()
           at Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore.LoadDataFromStore()
           at Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.BaseBackingStore.Load()
           at Microsoft.Practices.EnterpriseLibrary.Caching.Cache..ctor(IBackingStore backingStore, CacheCapacityScavengingPolicy scavengingPolicy, CachingInstrumentationProvider instrumentationProvider)
           at Microsoft.Practices.EnterpriseLibrary.Caching.CacheManagerFactoryHelper.BuildCacheManager(String cacheManagerName, IBackingStore backingStore, Int32 maximumElementsInCacheBeforeScavenging, Int32 numberToRemoveWhenScavenging, Int32 expirationPollFrequencyInSeconds, CachingInstrumentationProvider instrumentationProvider)
           at Microsoft.Practices.EnterpriseLibrary.Caching.CacheManagerCustomFactory.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
           at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
           at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
           at Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
           at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
           at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
           at Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
           at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
           at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp[TTypeToBuild](IReadWriteLocator locator, String idToBuild, Object existing, PolicyList[] transientPolicies)
           at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, IConfigurationSource configurationSource)
           at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.LocatorNameTypeFactoryBase`1.CreateDefault()
           at Microsoft.Practices.EnterpriseLibrary.Caching.CacheFactory.GetCacheManager()
           at Levi.LSA.USDistribution.Orion.InboundLogistics.CacheData.GetData() in D:\Orion\Development\SCSF\Source\InboundLogistics\Levi.LSA.USDistribution.Orion.InboundLogistics\CacheData.cs:line 16
           at Levi.LSA.USDistribution.Orion.InboundLogistics.InboundTrailersSearchPresenter.GetDefaultValues() in D:\Orion\Development\SCSF\Source\InboundLogistics\Levi.LSA.USDistribution.Orion.InboundLogistics\Views\InboundTrailersSearchPresenter.cs:line 117
           at Levi.LSA.USDistribution.Orion.InboundLogistics.InboundTrailersSearch.SetDefaultValues() in D:\Orion\Development\SCSF\Source\InboundLogistics\Levi.LSA.USDistribution.Orion.InboundLogistics\Views\InboundTrailersSearch.cs:line 59
           at Levi.LSA.USDistribution.Orion.InboundLogistics.InboundTrailersSearch.OnLoad(EventArgs e) in D:\Orion\Development\SCSF\Source\InboundLogistics\Levi.LSA.USDistribution.Orion.InboundLogistics\Views\InboundTrailersSearch.cs:line 43
           at System.Windows.Forms.Form.OnCreateControl()
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl()
           at System.Windows.Forms.Control.WmShowWindow(Message& m)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at System.Windows.Forms.ContainerControl.WndProc(Message& m)
           at System.Windows.Forms.Form.WmShowWindow(Message& m)
           at System.Windows.Forms.Form.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
           at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
           at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
           at System.Windows.Forms.Control.set_Visible(Boolean value)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
           at System.Windows.Forms.Form.ShowDialog()
           at Levi.LSA.USDistribution.Orion.InboundLogistics.ModuleController.ShowInboundTrailersSearchHandler(Object sender, EventArgs e) in D:\Orion\Development\SCSF\Source\InboundLogistics\Levi.LSA.USDistribution.Orion.InboundLogistics\ModuleController.cs:line 156
           at Microsoft.Practices.CompositeUI.Commands.Command.OnExecuteAction(Object sender, EventArgs e)
           at Microsoft.Practices.CompositeUI.Commands.CommandAdapter.FireCommand()
           at Microsoft.Practices.CompositeUI.Commands.EventCommandAdapter`1.InvokerEventHandler(Object sender, EventArgs e)
           at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
           at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
           at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
           at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
           at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
           at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
           at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at System.Windows.Forms.ToolStrip.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at Microsoft.Practices.CompositeUI.WinForms.FormShellApplication`2.Start()
           at Microsoft.Practices.CompositeUI.CabApplication`1.Run()
           at Levi.LSA.USDistribution.Orion.Infrastructure.Shell.ShellApplication.RunInDebugMode() in D:\Orion\Development\SCSF\Source\Infrastructure\Levi.LSA.USDistribution.Orion.Shell\ShellApplication.cs:line 56
           at Levi.LSA.USDistribution.Orion.Infrastructure.Shell.ShellApplication.Main() in D:\Orion\Development\SCSF\Source\Infrastructure\Levi.LSA.USDistribution.Orion.Shell\ShellApplication.cs:line 47
           at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()

    Thanks in advance for your kindly help.

    Thursday, June 28, 2007 9:44 PM

All replies

  • It looks like you are trying to set up a dependecy on a file that either don't exist (in the IsolatedStorage, aka user store) or you don't have sufficent permissions for.
    Friday, June 29, 2007 8:56 AM
  • Hi

     

    I am sorry i could not get that.

    This error i get when i am reading from cache. I am not getting this error while i am writing to the cache.

    I don't set any dependency  explicitly in the code.

    Please find the following code and config code that is written.

    Appreciate your hlep on this.

    Please let me know if you need any other information from me.

     

    public object GetData(String cacheName)

    {

    object request = null;

    CacheManager cache = CacheFactory.GetCacheManager();

    request = cache[cacheName];

    if (request == null)

    {

    CacheDataProvider dataProvider = new CacheDataProvider();

    request = dataProvider.GetInboundTrailerSearchValues(cacheName);

    AbsoluteTime expiry = new AbsoluteTime(new TimeSpan(1, 0, 0, 0)); //1 day

    cache.Add(cacheName, request, CacheItemPriority.High, null, new ICacheItemExpiration[] { expiry });

    }

    return request;

     

    Config code

     

    <cachingConfiguration defaultCacheManager="Cache Manager">

    <cacheManagers>

    <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000"

    numberToRemoveWhenScavenging="10" backingStoreName="Isolated Storage"

    name="Cache Manager" />

    </cacheManagers>

    <backingStores>

    <add partitionName="InboundLogistics" encryptionProviderName=""

    type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"

    name="Isolated Storage" />

    </backingStores>

    Friday, June 29, 2007 2:54 PM