Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing a namespace in web service

Status
Not open for further replies.

Peppi

Programmer
Apr 9, 2001
205
CA
Hi,

I'm trying to import a namespace in my web service, but it is not being recognized. The applicable code for my namespace exists in the App_Code directory of my web site.

Does anyone know how I can get the namespace to be recognized?

Thx.
 
using My.NameSpace.For.This.Object;

if you cannot reference the namespace, then something is missing:
1. the assembly is not referenced
2. the object you want to reference is does not have the proper exposure (public/private/protected/internal...)
3. the namespace is spelled incorrectly

if the code is in the App_Code directory then it's either 2 or 3. by default objects are private unless otherwise stated
so
[tt]class Foo[/tt] is the same as [tt]internal class Foo[/tt] (I might have my accessors mixed up)

the ctor accessor my also play a role in the exposure.
Code:
public class Foo
{
   private Foo() {}
}
cannot be accessed without reflection.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
It's not 2 or 3 as this class is referenced numerous times elsewhere in the application. I suspect it's related to the fact that the classes that reside in App_Code don't get compiled to a dll that resides in the bin directory. I've never written a web service before so I'm not sure if that's the case, or what to do about it. I don't want to have to move the code out of the App_Code directory.
 
it's not a name resolution conflict is it?
where you have the same object name in 2 different namespaces? then you would need to either fully qualify, or alias one of the objects.

other than that i'm stumped. not sure what to do in this case.


Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top