By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,905 Members | 900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,905 IT Pros & Developers. It's quick & easy.

Can't use System.Runtime.Remoting.Channels.Http in WebService?

P: n/a
I'm trying to use a Web Service to be a Remoting client of an existing
..NET 2.0 server. But I get the following error when I try to use
System.Runtime.Remoting.Channels.Http in my WebService. The same code
works fine in a standalone app. I have inspected
System.Runtime.Remoting.dll with ildasm, and I can see the
....Channels.Http namespace there. I verified that the virtual
directory is configured to use v2.0.50727 (the error message confirms
this). Am I missing something?

Thanks,
Kirk

Server Error in '/WS1' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'Http' does
not exist in the namespace 'System.Runtime.Remoting.Channels' (are you
missing an assembly reference?)

Source Error:

Line 5: using System.Runtime.Remoting;
Line 6: using System.Runtime.Remoting.Channels;
Line 7: using System.Runtime.Remoting.Channels.Http;
Line 8: using SimpleRemotingAsm;
Line 9:
Source File: d:\web_services\mystuff\WS1\App_Code\Service.cs Line: 7


Show Detailed Compiler Output:
c:\windows\system32\inetsrv>
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc .exe" /t:library
/utf8output
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configurati on\2.0.0.0__b03f5f7f11d50a3a\System.Configuration. dll"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\T emporary ASP.NET
Files\ws1\423f29b4\cc2e710\assembly\dl3\9bd5aebf\0 0a8f36d_1a37c601\SimpleRemotingAsm.DLL"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0 .0.0__b03f5f7f11d50a3a\System.Drawing.dll"
/R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0_ _b77a5c561934e089\System.Data.dll"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\m scorlib.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Service s\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dl l"
/R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseSer vices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseS ervices.dll"
/R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__ b03f5f7f11d50a3a\System.Web.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0 __b77a5c561934e089\System.Xml.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\ 2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b7 7a5c561934e089\System.dll"
/out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \Temporary ASP.NET
Files\ws1\423f29b4\cc2e710\App_Code.6f30um4y.dll" /debug- /optimize+
/w:4 /nowarn:1659;1699
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET
Files\ws1\423f29b4\cc2e710\App_Code.6f30um4y.0.cs"
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET
Files\ws1\423f29b4\cc2e710\App_Code.6f30um4y.1.cs"
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

d:\web_services\mystuff\WS1\App_Code\Service.cs(7, 40): error CS0234:
The type or namespace name 'Http' does not exist in the namespace
'System.Runtime.Remoting.Channels' (are you missing an assembly
reference?)

Show Complete Compilation Source:
Line 1: using System;
Line 2: using System.Web;
Line 3: using System.Web.Services;
Line 4: using System.Web.Services.Protocols;
Line 5: using System.Runtime.Remoting;
Line 6: using System.Runtime.Remoting.Channels;
Line 7: using System.Runtime.Remoting.Channels.Http;
Line 8: using SimpleRemotingAsm;
Line 9:
Line 10: [WebService(Namespace = "http://tempuri.org/")]
Line 11: [WebServiceBinding(ConformsTo =
WsiProfiles.BasicProfile1_1)]
Line 12: public class Service : System.Web.Services.WebService
Line 13: {
Line 14: public Service () {
Line 15:
Line 16: //Uncomment the following line if using designed
components
Line 17: //InitializeComponent();
Line 18: }
Line 19:
Line 20: [WebMethod]
Line 21: public string HelloWorld()
Line 22: {
Line 23: return "Hello World";
Line 24: }
Line 25:
Line 26: [WebMethod]
Line 27: public void Main(string[] args)
Line 28: {
Line 29: // Create a new HttpChannel
Line 30: HttpChannel c = new HttpChannel();
Line 31: ChannelServices.RegisterChannel(c);
Line 32:
Line 33: // Get a proxy to remote object.
Line 34: object remoteObj = Activator.GetObject(
Line 35: typeof(SimpleRemotingAsm.RemoteMessageObject),
Line 36: "http://localhost:32469/RemoteMsgObj.soap");
Line 37:
Line 38: RemoteMessageObject simple =
(RemoteMessageObject)remoteObj;
Line 39: simple.DisplayMessage("Hello from the client!");
Line 40: return simple.ReturnMessage();
Line 41: }
Line 42: }
Line 43:

Feb 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I noticed that on my web server, all my file associations for aspx,
asax, ascx, etc. all point to v1.1 of the framework. I installed the
2.0 framework on that machine, but it apparently didn't update all the
file associations. Is there something I can run to update them? Is it
possible this is the source of my problem?

Thanks,
Kirk

Feb 21 '06 #2

P: n/a
Well, I figured out my original problem. I needed to add a reference
to the assembly System.Runtime.Remoting in my Web.Config as follows:

<assemblies>
<add assembly="System.Runtime.Remoting, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>

Visual Studio 2005 can do this for you if you right click in the
Solution Explorer and select Add Reference...

Feb 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.