我需要在我的网络中重新创建一个提供者。配置文件看起来像这样:
<membership defaultProvider="AspNetSqlMemProvider">
<providers>
<clear/>
<add connectionStringName="TRAQDBConnectionString" applicationName="TRAQ" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0"
name="AspNetSqlMemProvider"
type="System.Web.Security.SqlMembershipProvider, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"
/>
</providers>
</membership>
然而,我得到一个运行时错误,说这个程序集无法加载,我认为这是因为我有错误的PublicKeyToken。如何为程序集查找PublicKeyToken ?
或者,我是否完全走错了方向?
正如@CRice所说,您可以使用下面的方法获得带有publicKeyToken的依赖程序集列表
public static int DependencyInfo(string args)
{
Console.WriteLine(Assembly.LoadFile(args).FullName);
Console.WriteLine(Assembly.LoadFile(args).GetCustomAttributes(typeof(System.Runtime.Versioning.TargetFrameworkAttribute), false).SingleOrDefault());
try {
var assemblies = Assembly.LoadFile(args).GetReferencedAssemblies();
if (assemblies.GetLength(0) > 0)
{
foreach (var assembly in assemblies)
{
Console.WriteLine(" - " + assembly.FullName + ", ProcessorArchitecture=" + assembly.ProcessorArchitecture);
}
return 0;
}
}
catch(Exception e) {
Console.WriteLine("An exception occurred: {0}", e.Message);
return 1;
}
finally{}
return 1;
}
我通常使用它作为一个LinqPad脚本
你可以称之为
DependencyInfo(“@c: \ MyAssembly.dll”);从代码中