问题描述
为什么我用WellKnownClientTypeEntry[]wellKnownClientTypeEntryArray=System.Runtime.Remoting.RemotingConfiguration.GetRegisteredWellKnownClientTypes();取出来的wellKnownClientTypeEntryArray数组中的元素为0个?RemotingConfig.config文件:<?xmlversion="1.0"encoding="utf-8"?><configuration><system.runtime.remoting><system.runtime.remoting><applicationname="RemotingServer"><client><wellknowntype="ServerRemoteObject.ICustomerManager,NCWebGIS"url="http://localhost:1234/CustomerManager.soap"/></client><channels><channelref="http"port="1234"><!--<providertype="Microsoft.Samples.Runtime.Remoting.Security.SecurityClientChannelSinkProvider,Microsoft.Samples.Runtime.Remoting.Security"securityPackage="negotiate"impersonationLevel="identify"authenticationLevel="packetPrivacy"/>--></channel></channels></application><!--<application><channels><channelref="http"port="1234"><clientProviders><formatterref="soap"/></clientProviders></channel></channels><clienturl="http://localhost:1234/RemotingServer"><wellknowntype="ServerRemoteObject.ICustomerManager,RemoteObjectApplication"url="http://localhost:1234/CustomerManager.soap"/><activatedtype="ServerRemoteObject.MyRemoteObjectClientActivate,RemoteObjectApplication"/></client></application>--><debugloadTypes="true"/></system.runtime.remoting></system.runtime.remoting></configuration>Global.asax文件:voidApplication_Start(objectsender,EventArgse){//CodethatrunsonapplicationstartupSystem.Runtime.Remoting.RemotingConfiguration.Configure(Server.MapPath("RemotingConfig.config"));}...........Default.aspx.cs文件:protectedvoidButton1_Click(objectsender,EventArgse){ICustomerManagerpCustomerManager=(ICustomerManager)RemotingHelper.CreateProxy(typeof(ICustomerManager));this.ListBox1.Items.Add("Client.Main():ReferencetoCustomerManageracquired");Customercustomer=pCustomerManager.GetCustomer(4711);intage=customer.GetAge();this.ListBox1.Items.Add("Client.Main():Customer"+customer.FirstName+""+customer.LastName+"is"+age+"yearsold.");CustomercustomerValidate=newCustomer();customerValidate.FirstName="Joe";customerValidate.LastName="Smith";customerValidate.DateOfBirth=newDateTime(1800,5,12);this.ListBox1.Items.Add("Client.main():Willcallvalidate");ValidationResultvalidationResult=pCustomerManager.Validate(customerValidate);this.ListBox1.Items.Add("Client.main():Validationfinished");this.ListBox1.Items.Add("Validationresultfor"+customerValidate.FirstName+""+customerValidate.LastName+"->"+""+validationResult.Ok.ToString()+":"+validationResult.ValidationMessage);}................
解决方案
解决方案二:
友情up
解决方案三:
学习,不会Remoting
解决方案四:
学习