Working with Web Services in Visual Studio 2005

 Hi all,

    I'm new to ASP.NET and web services.

    I'm able to create a web service successfully.And i tried to add it as a web referrence to another ASP.NET application.The Add Web Referrence dialog window displays my web service,but when i clicked the link to add it,i got this error:

    "Server cannot access application directory  'C:\WebSites\MyWebService\'. The directory does not exist or is not accessible because of security settings."

   If anyone knows how to solve this ,plz help.

 




Answer this question

Working with Web Services in Visual Studio 2005

  • OGData

    I've also this problem but there is asp.net version 2.0.50727 installed.
    When I try to add it on windows application it works fine.
    When I try to add it on a pocketpc application I still get this error

    grtz


  • Ant_59

    Hi Steve,

       Thanks for your reply.

    Yes,my App_Code directory is located at c:\TestingWebServices\MyWebServices.

    And i proceeded in the same way as u said, but still getting the same error as before.Tongue Tied

    Will u please tell me the step by step procedure to create and consume a web service (VS 2005)



  • kevingpo

    HI,

    This solution really works so I guess there are a incompatibilities in version 1 and 2. Oh well. I am actually writing a webservice to authenticate via active directory. The service is working and i can invoke it. The problem I am having is that when I call the webservice directly it the AUTH_USER field value which is my correct userid but when I call the service from my default.aspx page it returns "NT AUTHORITY\NETWORK SERVICE". Any ideas on what is going on

    Regards,
    cfusion.



  • Mike Williams28205

    Hi Anarchy,
     
          Thanks for spending your time to reply me.

          I tried to load the web service in a browser(IE),its working quite well(with or without  checking the NTLM authentication).

          But i'm getting the following error when i tried to add it as web referrence to another ASP.NET application,

    "Server Error in '/TestingWebServices' Application

    Parser Error

    Description:
    An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message:
    Could not create type 'Service'.

    Source Error:


    Line 1: <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="Service" %> 

    Source File: C:\TestingWebServices\MyWebService\Service.asmx    Line: 1"

    I've added this C:\TestingWebServices folder as "Virtual Directory" in IIS.


  • azmath76

    I got it.

    Go to virtual directory ('TestWebService2' in my case) in IIS.
    Right click -> Properties -> ASP.Net -> select the version to be 2.0. .

    Regards
    shwe


  • aravinda.kishore

    Hi All,
    I am having the same problem as Padma.
    I have been working with Visual Studio 2003 Web Services. There were simple.
    Even the folders and file names are totally diffrent in studio 2005.

    E.g. I created a WebService named 'TestWebService2'.
    But the dll name I got from that project is 'App_Code.dll' in bin directory.
    Published folder structure is -

    c:\TestWebService2\TestWebService2.asmx
    c:\TestWebService2\Web.config
    c:\TestWebService2\Bin\App_Code.dll

    In IIS, I created a virtual directory to c:\TestWebService2
    When I access that virtual directory, the error was the same as Padma had -


    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not create type 'TestWebService2'.

    Source Error:

    Line 1: <%@ WebService Language="C#" CodeBehind="~/App_Code/TestWebService2.cs" Class="TestWebService2" %>

    Source File: C:\Inetpub\wwwroot\DOTNETTests\TestWebService2\TestWebService2.asmx Line: 1


    Will please somebody help out

    Thanks
    shwe


  • jlc72

    Hi shwe,

    Great!! Thanks for the solution!!!!



  • Cp1der

    Hi Padma,



    In a previous post you said that you had an IIS Virtual Directory pointed at

    C:\TestingWebServices


    but it looks like you've created the ASP.NET web project underneath that (at c:\TestingWebServices\MyWebServices). Is your App_Code directory located at c:\TestingWebServices\MyWebServices\App_Code by any chance



    If so, the solution is simple - just move the virtual directory one level deeper so it points at c:\TestingWebServices\MyWebServices. Then everything should be OK.



    ASP.NET projects must live at the top of the virtual directory hierarchy and not in subroots.



    Hope that helps

    -steve

  • Chatterbox

    Hi Yasser,

        Thanks for ur reply.

        Yes, the file 'Service.cs' is there.

    The class 'Service' is attributed with

    [WebService(Namespace = "http://tempuri.org/")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    Even if i change the Namespace to anyother URI, i'm getting the same errror.

    Help me.




  • lf3877

    try re-installing the frameworks

  • Jari Haaranen

    This message means the class Service could not be loaded for some reason. It looks like the class is in a code behind file. Is the file really there Is the class called Service with no namespace
  • emilychou

    In the WebService you are trying to add to another project, go to the Property Pages, then Start Options, and uncheck NTLM Authentication.

    A good way to check if your webservice is running and is accessible, try loading it in a browser window

  • Working with Web Services in Visual Studio 2005