D
Dan Holmes
I can't find where i have declared ICategoryService as being in the
IVS.WMS.Product namespace. I have recompiled. Deleted the obj and bin
dirs. Removed the reference. I can't figure out how the Server dll
thinks the ICategoryService interface is in the IVS.WMS.Product
namespace instead of the one that is defined in Common (just IVS.WMS).
The error that is given
..\IVS.WMS.Category.Server.dll => Could not load type
'IVS.WMS.Product.ICategoryService' from assembly 'IVS.WMS.Category.
Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
System.Reflection.ReflectionTypeLoadException: Unable to load one or
more of the requested types. Retrieve the LoaderExc
eptions property for more information.
at System.Reflection.Module.GetTypesInternal(StackCrawlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at IVS.Framework.ApplicationServer.RefreshConfiguration()
Declaration in IVS.WMS.Category.Server.dll
namespace IVS.WMS
{
public sealed class CategoryService :
IAF.Configuration.ConfigurableComponent, ICategoryService
{
....
}
Declaration in IVS.WMS.Category.Common.dll
namespace IVS.WMS
{
namespace Category
{
public static class Constants
{
public const string ComponentID = "CATEGORY";
}
}
public interface ICategoryService
{
....
}
Code that loads all the server dlls into a remoting session
static void RefreshConfiguration()
{
try
{
RemotingConfiguration.Configure("ApplicationServer.exe.config", false);
String[] files = System.IO.Directory.GetFiles(".",
"IVS*Server.dll", System.IO.SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
Console.Write(file + " => ");
System.Reflection.Assembly a =
System.Reflection.Assembly.LoadFrom(file);
foreach (Type t in a.GetTypes())
{
if (t.Name.Contains("Service"))
{
foreach (Type inte in t.GetInterfaces())
{
if (inte.Name.Contains("Service"))
{
Console.WriteLine(inte.FullName);
RemotingConfiguration.RegisterWellKnownServiceType(
new
WellKnownServiceTypeEntry(t, inte.FullName,
WellKnownObjectMode.SingleCall));
}
}
}
}
}
}
catch (System.Reflection.ReflectionTypeLoadException ex)
{
foreach (Exception e in ex.LoaderExceptions)
Console.WriteLine(e.Message);
Console.WriteLine(ex.ToString());
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString() + Environment.NewLine +
ex.Message);
}
}
IVS.WMS.Product namespace. I have recompiled. Deleted the obj and bin
dirs. Removed the reference. I can't figure out how the Server dll
thinks the ICategoryService interface is in the IVS.WMS.Product
namespace instead of the one that is defined in Common (just IVS.WMS).
The error that is given
..\IVS.WMS.Category.Server.dll => Could not load type
'IVS.WMS.Product.ICategoryService' from assembly 'IVS.WMS.Category.
Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
System.Reflection.ReflectionTypeLoadException: Unable to load one or
more of the requested types. Retrieve the LoaderExc
eptions property for more information.
at System.Reflection.Module.GetTypesInternal(StackCrawlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at IVS.Framework.ApplicationServer.RefreshConfiguration()
Declaration in IVS.WMS.Category.Server.dll
namespace IVS.WMS
{
public sealed class CategoryService :
IAF.Configuration.ConfigurableComponent, ICategoryService
{
....
}
Declaration in IVS.WMS.Category.Common.dll
namespace IVS.WMS
{
namespace Category
{
public static class Constants
{
public const string ComponentID = "CATEGORY";
}
}
public interface ICategoryService
{
....
}
Code that loads all the server dlls into a remoting session
static void RefreshConfiguration()
{
try
{
RemotingConfiguration.Configure("ApplicationServer.exe.config", false);
String[] files = System.IO.Directory.GetFiles(".",
"IVS*Server.dll", System.IO.SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
Console.Write(file + " => ");
System.Reflection.Assembly a =
System.Reflection.Assembly.LoadFrom(file);
foreach (Type t in a.GetTypes())
{
if (t.Name.Contains("Service"))
{
foreach (Type inte in t.GetInterfaces())
{
if (inte.Name.Contains("Service"))
{
Console.WriteLine(inte.FullName);
RemotingConfiguration.RegisterWellKnownServiceType(
new
WellKnownServiceTypeEntry(t, inte.FullName,
WellKnownObjectMode.SingleCall));
}
}
}
}
}
}
catch (System.Reflection.ReflectionTypeLoadException ex)
{
foreach (Exception e in ex.LoaderExceptions)
Console.WriteLine(e.Message);
Console.WriteLine(ex.ToString());
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString() + Environment.NewLine +
ex.Message);
}
}