 |
|
|
hi, sorry it not good to copy others work. u copied from http://aspalliance.com writen by Abhishek Kumar Singh.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Just check few facts before blaming some one. I have posted this article in 2005 and your Abhishek has joined the site you mentioned less than a year ago, on 25 Mar 2007 to be exact and I am not sure when wrote the article.
This article is my original. I have nothing more to say.
Regards Raj
Raj Settipalli
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi , First of all very much thanks for this article , and my full vote .
I know only c# ,so I have written a simple app as follows to host in IIS
using System;
namespace SvrApp { /// /// Summary description for Class1. /// public class CRemotable:MarshalByRefObject { public CRemotable() { // // TODO: Add constructor logic here // } public string Hello() { return "Hello.... blah blah.."; } } }
and created the web.config
<!-- AjaiX.rem also seems working fine --> <formatter href="binary" />
created a folder c:\inetpub\wwwroot\AjaiX\ and bin folder under this and pasted the file under bin as well as ajaix too , I dont know some times its showing file not found error , so i did like this
and generated stub like this soapsuds -url http://ajai/ajaix/ajaix.soap?wsdl -gc
and created a console app which is the client
class IISHostTester { public static void Main() { SvrApp.CRemotable obj =Activator.GetObject(typeof(SvrApp.CRemotable),"http://ajai/ajaix/ajaix.soap") as SvrApp.CRemotable; if(obj!=null) { Console.WriteLine(obj.Hello()); } Console.Read(); } }
This is just working fine , But the problem comes when I compile the code in .net 2.0 it will show the following error ....if i host the same dll compiled using csc2.0 , do you know how to solve this . I set the guid for the assembly every thing but still the problem is there .
Please let me know how to solve it this is coming in the Internet Explorer
System.BadImageFormatException: The format of the file 'SvrApp' is invalid. File name: "SvrApp" at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark) at System.Reflection.Assembly.Load(String assemblyString) at System.Runtime.Remoting.RemotingConfigInfo.LoadType(String typeName, String assemblyName) at System.Runtime.Remoting.RemotingConfigInfo.GetServerTypeForUri(String URI) at System.Runtime.Remoting.RemotingConfigHandler.GetServerTypeForUri(String URI) at System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI) at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.CanServiceRequest(HttpContext context) at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessRequest(HttpContext context)
=== Pre-bind state information === LOG: DisplayName = SvrApp (Partial) LOG: Appbase = file:///c:/inetpub/wwwroot/AjaiX LOG: Initial PrivatePath = bin Calling assembly : (Unknown). ===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: SvrApp LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/ajaix/f395f484/78813567/SvrApp.DLL. LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/ajaix/f395f484/78813567/SvrApp/SvrApp.DLL. LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/AjaiX/bin/SvrApp.DLL.
<
Warm Regards Ajai NP
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
Hi,
what if the server assembly contains more than one class. then what will be the value in the "Type" property. ??
Please suggest.
Thanks & Regards, Sanjiv
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Hi,
great article, but i cant get it to work. I get the error 'Cannot load type' etc on my client app. I can open up the ...soap?wsdl file fine in a browser.
what could be causing this? i have tried everything!
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
Not sure if it's a typo above or a change in the server config to effectively get a binary channel (instead of the default soap which does not want to serialize generic types)
The channels section must be: <formatter ="binary" /> with the tag inside the tag.
I also had to provide a configuration for the client otherwise I was getting an exception "ArgumentNullException: No message was deserialized prior to calling the DispatchChannelSink". Again I believe that without the config, the client will try to use the default soap formatter.
Client config: <formatter ref="binary" />
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, thanks for the easy and simple piece of code... you solved my problem. I was able to nicely run it when I use:
objRemote = (IServer.IServer)Activator.GetObject(typeof(IServer.IServer), "http://localhost/Server/Server.soap");
But it gives me the following error when I put it on a real website and use the following:
objRemote = (IServer.IServer)Activator.GetObject(typeof(IServer.IServer), "http://www.samplewebsite.com/Server/Server.soap");
I have put the "Server" folder in the wwwroot folder for both the cases. I tried the IP address as well instead of the URL. But still the same error:
An unhandled exception of type 'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll
Additional information: Server encountered an internal error. To get more info turn on customErrors in the server's config file.
.Net all the way. Hemal
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Have you tried to get WSDL from that URL. Try that first, if not then there is something wrong with .NET installation if you have set the website correctly. Check if you have created virtual server for the remote component!
Regards Raj Settipalli
Raj Settipalli
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
You have given an excellent example to understand Remoting under IIS env.
I am implementing the same using C# (no specific reason but started to work in C#). I am not able to implement it successfully. I downloaded your code and tried it out but and its working fine.
Error i am getting is
System.Runtime.Remoting.RemotingException: Cannot load type Server.clsServer, Server. at System.Runtime.Remoting.RemotingConfigInfo.LoadType(String typeName, String assemblyName) at System.Runtime.Remoting.RemotingConfigInfo.GetServerTypeForUri(String URI) at System.Runtime.Remoting.RemotingConfigHandler.GetServerTypeForUri(String URI) at System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI) at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.CanServiceRequest(HttpContext context) at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessRequest(HttpContext context)
So please help me out of this!
Thank you
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
My question is that i wanted to know if you can use CAO(Client Activated Object) instead of use WKO(WellKnown Objects) in that case(ASP.Net as a client and IIS as a Server)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Yes you can. use Activator.CreateInstance instead of Activator.GetObject. Config settings also needs to be changed. For more info on this please refer to MSDN object activation and life time under remoting.
Regards
Raj Settipalli
|
| Sign In·View Thread·PermaLink | 3.00/5 (2 votes) |
|
|
|
 |
|
|
I get thos error when I try to call a remote class method. What could it be the reason? Thanks for any idea.
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
|
I too got the same error when i try with different name for the objURI to some thing else . it will work only with .soap or .rem if you give some thing else then same error will get
Warm Regards Ajai NP
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
System.Runtime.Remoting.RemotingException: Cannot load type Server.clsServer, Server. at System.Runtime.Remoting.RemotingConfigInfo.LoadType(String typeName, String assemblyName) at System.Runtime.Remoting.RemotingConfigInfo.GetServerTypeForUri(String URI) at System.Runtime.Remoting.RemotingConfigHandler.GetServerTypeForUri(String URI) at System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI) at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.CanServiceRequest(HttpContext context) at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessRequest(HttpContext context)
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
Can you please let me know how you have set up your server.dll under IIS. If you have not created IIS application out of the folder that you have created you may get this error.
Regards Raj
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I create the server directrory by Vitrual Directory Creation Wizard
and created a sub folder bin inside that Server folder and copied the server.dll into that
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
What about the web.config file under Server folder. If it is there, check the execution path for .soap extension under configuration settings of your webserver. If these setttings are missing then you may need to repair your .net installation. Or try this also. Copy the server.dll into the server folder and then create virtual directory. I tried few things but not able to reproduce the error.
You can also load the dll in some other project(add reference) and see the class type in Object browser. If you have compiled the demo project under different namespace, then you need to include the namespace also before class name, for example "RootNamespace.Namesapce.classname, assemblyname" You can check the rootnamespace using project properties, assembly name is name of the dll file.
Hope this will clarify.
Regards Raj
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I had to copy all of the files from the bin directory for Server instead of just the server.dll file. It worked after that.
Take Care, Mike
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi all, I have a problem. Everithing works fine, when I'm testing it on localhost. But, when I want to test it on IIS server on my ISP (where is hosted many webs) the server returns this error: 'The remote server returned an error: (404) Not Found.'
Any idea to solve this? Thank you!
Fipil
|
| Sign In·View Thread·PermaLink | 3.50/5 (2 votes) |
|
|
|
 |
|
|
This could be because of the following... 1. ASP.NET is not enabled either on webserver(client) or on remote machine(hosting remote component). 2. Replace all "http://localhost/" the URL of the actaul webserver. 3. Try replacing the remote host machine name with the IP address.
Raj Settipalli
|
| Sign In·View Thread·PermaLink | 2.33/5 (3 votes) |
|
|
|
 |