RE: [WebMethod] System.NullReferenceException: Object reference not set to an instance of an object.

From: Dan Rogers (danro_at_microsoft.com)
Date: 03/07/05


Date: Mon, 07 Mar 2005 23:28:02 GMT

Um, this isn't going to work, generally. Web services, as any web app
(especially on Windows server 2003) are heavily sandboxed. The method you
are calling requires full permissions to run. My guess is your exception
is caused by the Directory method returning null. Since you aren't error
checking that condition, you're seeing a null reference exception when you
tell your program to return the reference returned by the directory call.
Since that will fail due to security restrictions, it's pretty easy to say
this is your problem.

--------------------
>From: ivy ivy via .NET 247 <anonymous@dotnet247.com>
>X-Newsreader: AspNNTP 1.50 (Matthew Reynolds Consulting)
>Subject: [WebMethod] System.NullReferenceException: Object reference not
set to an instance of an object.
>Mime-Version: 1.0
>Content-Type: text/plain; charset="us-ascii"
>Content-Transfer-Encoding: quoted-printable
>Message-ID: <OeUyHx0IFHA.588@TK2MSFTNGP15.phx.gbl>
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
>Date: Mon, 07 Mar 2005 11:31:36 -0800
>NNTP-Posting-Host: 81-86-69-114.dsl.pipex.com 81.86.69.114
>Lines: 1
>Path:
TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP15.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:28460
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
>hi, i'm getting this error when ever i tr y to execute the following
code..
>can anyone help me with this ? thank you.
>System.Web.Services.Protocols.SoapException: Server was unable to process
request. ---> System.NullReferenceException: Object reference not set to an
instance of an object. at IDSSServer.IDSS.GetFileList(String fullpath) in
c:\inetpub\wwwroot\idssserver\idss.asmx.cs:line 92 --- End of inner
exception stack trace ---
> [WebMethod]
> public string[] GetFileList(string fullpath)
> {
>return System.IO.Directory.GetFiles(FullPath);
>(Type your message here)
>}
>client side::
>service.GetFileList("C:\\Inetpub\\wwwroot\\doc");
>i want to retrive all the files store in doc folder..
>--------------------------------
>From: ivy ivy
>-----------------------
>Posted by a user from .NET 247 (http://www.dotnet247.com/)
><Id>YGN1egUVV0K5eUulMnOO8Q==</Id>
>



Relevant Pages

  • Re: Problem depolying Orchestration as Web Service
    ... Please refer to the article "Enabling Web Services for Windows Server 2003" ... The inner exception of the soap exception ... > under an account that has access to the BizTalk databases. ...
    (microsoft.public.biztalk.general)
  • Re: OdbcConnection.Open error
    ... error was from a corrupted install of Windows Server (we think with the MDAC ... > Do you have an exception callstack, try printing the whole exception - not ... >> machine it is failing on is running Windows Server 2003. ...
    (microsoft.public.data.odbc)
  • Re: I am needing a gentle introduction to accessing a perl array from a reference
    ... up here, the DBI connection to the database, the select statement, ... Can you either post the fully relevant portions of your code, ... code in a web services program, as well as parts from a 50+ line ... hash given a reference. ...
    (comp.lang.perl.misc)
  • Re: Handling Exception in Web Services when using HttpGet protocol.
    ... > I have an application with several web services. ... > The problem is that my application web.config also enables the HttpGet ... When a client calls my web services ... > I get information about the exception itself. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Remote Desktop, encryption?
    ... I'm not coming up immediately with the reference you need about what ... controls encryption levels in the XP client. ... the client can't contravene that and connect successfullly. ... I know how to do this on a Windows Server 2003 ...
    (microsoft.public.windowsxp.work_remotely)

Loading