{"Can't find config file":null} {Name = "ConfigFile" FullName = "System.Data.Fabric.Common.ConfigFile"}
-
31 สิงหาคม 2552 3:37I have an unit test with following code. There's an Exception of "Can't find config file", whenever I create an instance of DataCacheFactory. All my configurations are put in code directly, and there's no config file for test project.
When I view detail for the exception, I can find DeclaringType with value of {Name = "ConfigFile" FullName = "System.Data.Fabric.Common.ConfigFile"}.
Call Stack:-
--
FabricCommon.dll!System.Data.Fabric.Common.ConfigFile.Load() + 0x131 bytes
FabricCommon.dll!System.Data.Fabric.Common.ConfigFile.Config.get() + 0xc0 bytes
FabricCommon.dll!System.Data.Fabric.Common.EventLogWriter.LoadSinkFromConfig() + 0x24 bytes
FabricCommon.dll!System.Data.Fabric.Common.EventLogWriter.EventLogWriter() + 0x18 bytes
[Native to Managed Transition]
[Managed to Native Transition]
ClientLibrary.dll!Microsoft.Data.Caching.DataCacheFactory.DataCacheFactory(Microsoft.Data.Caching.DataCacheServerEndpoint[] servers = {Microsoft.Data.Caching.DataCacheServerEndpoint[3]}, bool routingClient = true, bool localCache = false, Microsoft.Data.Caching.DataCacheLocalCacheSyncPolicy syncPolicy = NotificationBased, int localCacheTimeout = 300, int pollInterval = 300) + 0x151 bytes
My Code:-
--
[
TestMethod()]
public void PutObjectInNutShell()
{
Guid id = Guid.NewGuid();
Random r = new Random();
int obj = r.Next();
DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[3];
servers[0] =
new DataCacheServerEndpoint("10.222.100.151", 22233, "DistributedCacheService");
servers[1] =
new DataCacheServerEndpoint("10.222.100.152", 22233, "DistributedCacheService");
servers[2] =
new DataCacheServerEndpoint("10.222.100.153", 22233, "DistributedCacheService");
DataCacheFactory cacheFactory = new DataCacheFactory(servers, true, false, DataCacheLocalCacheSyncPolicy.NotificationBased, 300, 300);
// get cache client for cache "FirstCache"
DataCache _DC = cacheFactory.GetCache("VelocityCache");
_DC.Put(id.ToString(), obj);
}
Thanks a lot!
ตอบทั้งหมด
-
31 สิงหาคม 2552 5:38
Hi, does this come as an unhandled exception? This exception is actually internal to Velocity and is caught internally.
Amit. (Velocity Dev, MSFT)- ทำเครื่องหมายเป็นคำตอบโดย Ankur Agrawal-MSFTModerator 4 กันยายน 2552 21:52
-
1 กันยายน 2552 6:05It's indeed handled by Velocity internally, but still give me quite a shock. Isn't it not a good practice in C# to throw an exception, and then swallow it later?
-
1 กันยายน 2552 8:27
An exception normally means something bad has happened. It can be thrown and caught in code for various reasons:
1. It is only done in error scenarios so won’t be a perf hit for normal cases.
2. To maintain layering/stack of components.
3. Easier understandability.
Hence it is not bad to follow this approach. Does it make sense to you?
Amit. (Velocity Dev, MSFT)- ทำเครื่องหมายเป็นคำตอบโดย Ankur Agrawal-MSFTModerator 4 กันยายน 2552 21:52
-
12 มิถุนายน 2555 15:33
Hi All,
Getting the same error when using AppFabric 1.1.
However this is handled by MS internal exception.
The question is: is something wrong with the cache client or server configurations ?
Following is the DebugDiag 1.2 stack trace fragment
Microsoft.Fabric.Common.ConfigFile.Load() Microsoft.Fabric.Common.ConfigFile.get_Config() Microsoft.Fabric.Common.EventLogWriter.LoadSinkFromConfig() Microsoft.Fabric.Common.EventLogWriter..cctor() Microsoft.Fabric.Common.EventLogWriter.AddSink(Microsoft.Fabric.Common.IEventSink, Int32) Microsoft.ApplicationServer.Caching.DataCacheClientLogManager.Initialize(Microsoft.ApplicationServer.Caching.DataCacheLogSink) Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration.Initialize(System.String) MyTest.Init() [C:\Test\MyTestCache.cs @ 95] Thanks in advance,
Evgeny
EvgenyV