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
- Next message: Dan Rogers: "RE: Does anyone know how to encrypt source code"
- Previous message: Dan Rogers: "RE: Java webservice and C# client"
- In reply to: ivy ivy via .NET 247: "[WebMethod] System.NullReferenceException: Object reference not set to an instance of an object."
- Messages sorted by: [ date ] [ thread ]
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>
>
- Next message: Dan Rogers: "RE: Does anyone know how to encrypt source code"
- Previous message: Dan Rogers: "RE: Java webservice and C# client"
- In reply to: ivy ivy via .NET 247: "[WebMethod] System.NullReferenceException: Object reference not set to an instance of an object."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|