C# Simple Problem

Discussion in 'OT Technology' started by doggfather, Jun 18, 2006.

  1. doggfather

    doggfather New Member

    Joined:
    Aug 6, 2005
    Messages:
    224
    Likes Received:
    0
    Code:
     
    [COLOR=#0000ff]//DNSLookupService.asmx.cs[/COLOR]
    using[SIZE=2] System.Web.Services;
    [/SIZE][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][SIZE=2] System.Net;
    [WebServices([/SIZE][SIZE=2][COLOR=#0000ff]Namespace[/COLOR][/SIZE][SIZE=2]=[/SIZE][SIZE=2][COLOR=#800000]"http://www.bostontechnical.com/webservices/"[/COLOR][/SIZE][SIZE=2], Description=[/SIZE][SIZE=2][COLOR=#800000]"<b>A web service which performs Domain Name Lookups.</b>"[/COLOR][/SIZE][SIZE=2])]
    [/SIZE][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][SIZE=2] DNSLookupService : System.Web.Services.WebServices
    {
    [WebMethod]
    [/SIZE][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][SIZE=2] getIPforHostname([/SIZE][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][SIZE=2] strHostname)
    {
    IPHostEntry hostInfo = Dns.GetHostByName(strHostname);
    [/SIZE][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=2] hostInfo.AddressList[0].ToString();
    }
    }
    [/SIZE]
    In CMD, I do csc DNSLookupService.asmx.cs but I get
    Error CS0234: The type or namespae name 'WebServices' does not exist in the namespace 'System.Web.Services' (are you jmissing an assembly referenc)?
    Error CS0246: The type or namespace 'WebServices' coudl not be found (are yu missing a using directive or assembly reference?

    Also AFTER I compile it (once the Above problem is addddressed), is

    <%@ WebService Language="C#"Class="DNSLookupService" Codebehind="DNSLookupService.asmx.cs"%>

    how U write the attribute stuff in DNSLookupService.asmx?
     
  2. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    its been a while since i used C#
    can anyone remind me what the brackets and the stuff inside the brackets mean [ ]
     
  3. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
  4. doggfather

    doggfather New Member

    Joined:
    Aug 6, 2005
    Messages:
    224
    Likes Received:
    0
    But that requires Visual Studio .NET

    I simply have the free Visual Web Development and Visual C#, I need compiling with CMD
     
  5. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    You can't use an Express edition of Visual Studio?
     
  6. doggfather

    doggfather New Member

    Joined:
    Aug 6, 2005
    Messages:
    224
    Likes Received:
    0
    I couldn't find an express edition of Visual Studio .NET (If I missed it and U can find it, plz let me know)

    Only found Express Visual Web Developer and Express Visual C#

    But yea...if no VS.NET express ,then I have to go back to CMD, that's where I coudlnt compile it
     
  7. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    Those are the express editions of VS.NET. An express edition focuses on one aspect of VS.NET; like C#, or VB.NET, etc. You can't create your C# web services using that?
     
  8. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    http://msdn.microsoft.com/vstudio/express/support/faq/


     
  9. w0lverine

    w0lverine New Member

    Joined:
    Feb 22, 2005
    Messages:
    47
    Likes Received:
    0
    if there is only an assembly reference missing, you could try :

    "csc /r:system.web.services.dll DNSLookupService.asmx.cs"
     

Share This Page