I am trying to use the ServiceModelEx library from IDesign. When I try to call:
InProcFactory.CreateInstance();
from with in a WCF Service (basically calling WCF Service B from WCF Service A), I get the following error:
Could not find dynamic assembly
The code that is failing is:
internal static Assembly[] GetWebAssemblies()
{
Debug.Assert(IsWebProcess());
List<Assembly> assemblies = new List<Assembly>();
if(Assembly.GetEntryAssembly() != null)
{
throw new InvalidOperationException("Can only call in a web assembly");
}
foreach(ProcessModule module in Process.GetCurrentProcess().Modules)
{
assemblies.Add(Assembly.LoadFrom(module.FileName));
if (module.ModuleName.StartsWith("App_Code.") && module.ModuleName.EndsWith(".dll"))
{
assemblies.Add(Assembly.LoadFrom(module.FileName));
}
if (module.ModuleName.StartsWith("App_Web_") && module.ModuleName.EndsWith(".dll"))
{
assemblies.Add(Assembly.LoadFrom(module.FileName));
}
}
if (assemblies.Count == 0)
{
throw new InvalidOperationException("Could not find dynamic assembly");
}
return assemblies.ToArray();
}
The assemblies are not pre-fixed with App_Web or App_Code because this is not a web site or a web application (it is a WCF Service). The code does work, however, if I call it from a web site, web application or EXE. Is this by deisgn?