还是那个配置文件的问题!!

plumsoup 2005-07-03 11:06:57
这是怎么回事?咋办呢?
Failed to configure host application:Remoting configuration failed with the exception 'System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Remoting' or one of its dependencies. 系统找不到指定的文件。
File name: 'System.Runtime.Remoting'
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.LoadType(String typeName, String assemblyName)
at System.Runtime.Remoting.RemotingConfigHandler.CreateChannelFromConfigEntry(ChannelEntry entry)
at System.Runtime.Remoting.RemotingConfigHandler.ConfigureChannels(RemotingXmlConfigFileData configData)
at System.Runtime.Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlConfigFileData configData)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
'.
...全文
148 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
plumsoup 2005-07-05
  • 打赏
  • 举报
回复
第二个发错了,不好意。
<configuration>
<system.runtime.remoting>
<application name="ListServer">
<channels>
<channel displayName="MyChannel" type="System.Runtime.Remoting.Channels.Http.HttpChannel,System.Runtime.Remoting" port="8080" />
</channels>
<service>
<wellknown displayName="MyService" mode="Singleton" type="ListServer.CompanyLists,ListServer" objectUri="CompanyLists" />
</service>
</application>
<debug loadTypes="true" />
</system.runtime.remoting>
</configuration>
这个是书上给的例子,第一个是用vs自动生成的,第一个能用,这个放到工程里好像也认不出来。
两个也是有好多的不同的。为什么会不一样了呢?是不是有所改变了,因为书上用的是2003,我现在的是2005bate2。
plumsoup 2005-07-05
  • 打赏
  • 举报
回复
<configuration>
<system.runtime.remoting>
<application name="ListServer">
<channels>
<channel type="System.Runtime.Remoting.Channels.Http.HttpChannel,System.Runtime.Remoting" port="8080" />
</channels>
<service>
<wellknown mode="Singleton" type="ListServer.CompanyLists,ListServer" objectUri="CompanyLists" />
</service>
</application>
</system.runtime.remoting>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NETHost" publicKeyToken="4fa5cf37ae237122" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
plumsoup 2005-07-05
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="ListHost.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" />
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="ListHost.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
<userSettings>
<ListHost.Properties.Settings />
</userSettings>
<applicationSettings>
<ListHost.Properties.Settings>
<setting name="setting" serializeAs="String">
<value />
</setting>
</ListHost.Properties.Settings>
</applicationSettings>
</configuration>
renyu732 2005-07-03
  • 打赏
  • 举报
回复
不会的.
看看是不是IIS的问题.
plumsoup 2005-07-03
  • 打赏
  • 举报
回复
好像是因为配置文件有问题。是不是2005和2003中的格式有所不同呀?
plumsoup 2005-07-03
  • 打赏
  • 举报
回复
源码
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
using System.Diagnostics;
namespace ListHost2
{
class CompanyListHost
{
static void Main(string[] args)
{
EventLog myLog = new EventLog();
myLog.Source = "ListHost2";
bool failed=false;
try
{
HttpServerChannel myChannel = new HttpServerChannel(8080);
ChannelServices.RegisterChannel(myChannel);
myLog.WriteEntry("Registered HTTPChannel(8080)");
}
catch (Exception e)
{
myLog.WriteEntry("Failed to register HTTPChannel(8080)" + e.Message,
System.Diagnostics.EventLogEntryType.Error);
failed = true;
}

try
{
RemotingConfiguration.Configure(@"..\..\ListHost2.exe.config");
myLog.WriteEntry("Configuration from ListHost.exe.cfg Successful");
}
catch (Exception e)
{
myLog.WriteEntry("Failed to configure host application:" + e.Message,
System.Diagnostics.EventLogEntryType.Error);
failed = true;
}
if (failed)
{
System.Console.WriteLine("Error at startup - see Event Log:");
}
System.Console.WriteLine("Press [Enter] to exit ...");
System.Console.ReadLine();
}
}
}

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧