C# 找不到PublicKeyToken null
我创建了我的第一个windows窗体应用程序C#4.5 我在C# 找不到PublicKeyToken null,c#,deserialization,C#,Deserialization,我创建了我的第一个windows窗体应用程序C#4.5 我在C:\ 因此,我在该路径下安装了带有.exe的应用程序 应用程序将表序列化为二进制文件,然后将这些文件传输到远程服务器。 所有工作正常:创建>压缩>ftp传输 现在,当我尝试用ASP.NET反序列化时,我得到了一个错误: 程序集的myApplication,版本=1.0.0.0,区域性=neutral,PublicKeyToken= 找不到null 作为序列化程序,我使用的是BinaryFormatter 这个错误是什么意思 应用程序(
C:\
因此,我在该路径下安装了带有.exe
的应用程序
应用程序将表序列化为二进制文件,然后将这些文件传输到远程服务器。
所有工作正常:创建>压缩>ftp传输
现在,当我尝试用ASP.NET反序列化时,我得到了一个错误:
程序集的myApplication,版本=1.0.0.0,区域性=neutral,PublicKeyToken=
找不到null
作为序列化程序,我使用的是BinaryFormatter
这个错误是什么意思
应用程序(Windows窗体)和ASP.NET站点都在4.5中。
我该怎么办
这是反序列化代码:
public long Deserialize(SqlConnection ImportConnection)
{
String path = Path.Combine(HttpRuntime.AppDomainAppPath, "unZIP/AGENTI.bin");
long position = 0;
BinaryFormatter formatter = new BinaryFormatter();
long blocchi = 0;
using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
while (position < stream.Length)
{
stream.Seek(position, SeekOrigin.Begin);
var listAgenti = (List<AGENTI>)formatter.Deserialize(stream);
position = stream.Position;
foreach (AGENTI agente in listAgenti)
{
agente.InsertAgenti(ImportConnection, agente);
}
blocchi++;
}
stream.Flush();
}
return blocchi;
}
public长时间反序列化(SqlConnection-ImportConnection)
{
String path=path.Combine(HttpRuntime.AppDomainAppPath,“unZIP/AGENTI.bin”);
长位置=0;
BinaryFormatter formatter=新的BinaryFormatter();
long-blocchi=0;
使用(FileStream-stream=newfilestream(路径,FileMode.Open,FileAccess.Read))
{
while(位置<流长度)
{
stream.Seek(位置,SeekOrigin.Begin);
var listAgenti=(列表)格式化程序。反序列化(流);
位置=流位置;
foreach(listAgenti中的AGENTI agente)
{
InsertAgenti代理(进口连接,代理);
}
blocchi++;
}
stream.Flush();
}
返回布卢奇;
}
在我找到的file.bin中
... HApp_Code.kwqligxt,版本=0.0.0.0,区域性=中性,PublicKeyToken=null usSystem.Collections.Generic.List`1[[AGENTI,…]
以前的代码是在ASP.NET站点中进行序列化的,它可以工作,
现在它位于Windows窗体中,没有任何更改。请提供相关的代码。您可以发布代码吗?干杯