![](/img/trans.png)
[英]Entry point not found in assembly 'Microsoft.EntityFrameworkCore.Design, Version=1.1.0.0
[英]Entry point not found in assembly
我有一个应用程序,需要在其中创建AppDomain并将程序集加载到其中,并在程序集中执行方法。
这是我的代码
public class CreateAppDomain
{
public void CreateAppDom()
{
AppDomain domain = AppDomain.CreateDomain("myDomain");
domain.ExecuteAssembly(@"C:\Visual Studio 2005\Projects\A1\A1\bin\Debug\A1.dll");
domain.CreateInstanceFrom(@"C:\Visual Studio 2005\Projects\A1\A1\bin\Debug\A1.dll","A1.Navigate");
}
}
我上面的代码写在一个名为CreateAppDomain.cs的类文件中
在我的Default.aspx页面中,我创建了上述类的实例并称为create方法。
protected void Button1_Click(object sender, EventArgs e)
{
CreateAppDomain obj = new CreateAppDomain();
obj.CreateAppDom();
Response.Write("Application Domain Successfully created");
}
当我运行default.aspx页面时,出现错误提示
在程序集“ A1,版本= 1.0.0.0,文化=中性,PublicKeyToken =空”中找不到入口点。
任何人都可以向我解释上述错误的含义以及解决方法。
谢谢,
AppDomain.ExecuteAssembly()
方法将程序集加载到指定的域中,然后执行其标准入口点,即static void Main(string[] args)
方法。
在这里查看详细信息。
您想要的可能是CreateInstanceAndUnwrap()
方法的重载之一
编辑:
我创建了ConsoleApplication9,它是在ClassLibrary1之外添加的。 在ClassLibrary1中,我具有Class1
:
namespace ClassLibrary1
{
public class Class1 : MarshalByRefObject
{
public void Go()
{
Console.WriteLine("My AppDomain's FriendlyName is: {0}", AppDomain.CurrentDomain.FriendlyName);
}
}
}
在ConsoleApplication9中,这些是:
private static void Main(string[] args)
{
Console.WriteLine("Trying to run method in current domain...");
var inCurrentDomain = new Class1();
inCurrentDomain.Go();
Console.WriteLine("\nTrying to run method in remote domain...");
string asmName = typeof(Class1).Assembly.FullName;
string typeName = typeof (Class1).FullName;
Console.WriteLine("Class1's assembly name is: {0}\nType name: {1}", asmName, typeName);
var remoteDomain = AppDomain.CreateDomain("My remote domain");
var remoteObject = (Class1)remoteDomain.CreateInstanceAndUnwrap(asmName, typeName);
Console.WriteLine("\nRemote instance created. Running Go() method:");
remoteObject.Go();
}
运行时,我有:
Trying to run method in current domain... My AppDomain's FriendlyName is: ConsoleApplication9.exe Trying to run method in remote domain... Class1's assembly name is: ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Type name: ClassLibrary1.Class1 Remote instance created. Running Go() method: My AppDomain's FriendlyName is: My remote domain
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.