RE: Asynchronous Web Service Method Failure
From: Turbo (Turbo_at_discussions.microsoft.com)
Date: 12/21/04
- Next message: Fred Herring: "RE: Creating New Web Service"
- Previous message: AndyMalakov: "Re: wsdl.exe does not support mime:mimeXml as input encoding?"
- In reply to: Dan Rogers: "RE: Asynchronous Web Service Method Failure"
- Next in thread: Dan Rogers: "RE: Asynchronous Web Service Method Failure"
- Reply: Dan Rogers: "RE: Asynchronous Web Service Method Failure"
- Reply: Bruce Johnson: "RE: Asynchronous Web Service Method Failure"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 21 Dec 2004 08:11:16 -0800
You're probably right, and it's something I should have thought of myself.
Here are the steps involved:
When a session begins, I create a folder for that session in a virtual
directory that is set up for that and nothing else. Let's call it the
application file cache. It is not in the c:\inetpub\wwwroot folder. The
resulting folder looks like \application file caches\sessionid\ so each
session has a temporary disk space where the reports are created. This
folder is removed when the session ends.
When the user requests a report, sometimes a stream is opened to load some
xml that I would need for the report. To open a stream, I use
server.mappath(\application root\subfolder\textfilename).
When the report is completed, a file is created in his/her specific session
folder using server.mappath(\application file caches\sessionid\filename) and
the URL of the file is returned by the web service method. If I use a
streamwriter, the method fails. The error is generated when I try to make
the call to EndCreateReport(IAsyncResult) and this is where the message box
comes up. The real rub is that I don't know if the error occurs when opening
the streams, reading from them, or writing to them. The error is not caught
in the Try/Catch block.
Anyway, I'll look at the security thing.
"Dan Rogers" wrote:
> This could be a security issue. Because the request is originating thru
> the web service (asp.net), the permissions granted to the thread are indeed
> sandboxed. If you are calling the class dirctly, you are not encountering
> the sand box. Have you tried treating this as a permissions thing? For
> instance, if you only try to write to the services directory, and not to a
> root qualified path, do you have better luck? I should have thought of
> this possibility since it is such a common case.
>
> If you try to over-write an existing file in the local service directory,
> and you've explicitely granted permissions to the ASPNET_IIS web service
> account to that file, does it work any better? WS that write files are
> indeed problematic because they are so tightly sand boxed. If you think
> about it, the potential under high load to knock your server over when the
> disk is full is extremely likely. A common attack scenario involves web
> exposed calls that save files.
>
> Dan
> --------------------
> >Thread-Topic: Asynchronous Web Service Method Failure
> >thread-index: AcTkUwPdMeARkT8bTT+WHDnZWsK+gg==
> >X-WBNR-Posting-Host: 65.118.1.233
> >From: "=?Utf-8?B?VHVyYm8=?=" <Turbo@discussions.microsoft.com>
> >References: <4F6A0DC8-92A1-4BB9-9E07-43123A799944@microsoft.com>
> <00lXKSV4EHA.3388@cpmsftngxa10.phx.gbl>
> <E3D1275E-5CE8-4DCE-8145-0BAA1A0BE8EB@microsoft.com>
> <DUddYT64EHA.1964@cpmsftngxa10.phx.gbl>
> >Subject: RE: Asynchronous Web Service Method Failure
> >Date: Fri, 17 Dec 2004 08:11:07 -0800
> >Lines: 143
> >Message-ID: <79A48C7F-F977-4764-9037-78B1ECE7565B@microsoft.com>
> >MIME-Version: 1.0
> >Content-Type: text/plain;
> > charset="Utf-8"
> >Content-Transfer-Encoding: 7bit
> >X-Newsreader: Microsoft CDO for Windows 2000
> >Content-Class: urn:content-classes:message
> >Importance: normal
> >Priority: normal
> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
> >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
> >Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
> >Xref: cpmsftngxa10.phx.gbl
> microsoft.public.dotnet.framework.aspnet.webservices:27277
> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
> >
> >In clarification of my previous post, I have found that I cannot call web
> >service methods through a proxy if the method opens a stream reader or
> stream
> >writer. If I call the CreateReport method using the proxy, it will
> timeout.
> >If I call the BeginCreateReport method, it fails when attempting the use
> the
> >stream. The only way I can get the method to run successfully is to
> create
> >an instance of the web service directly, without using a proxy.
> >
> >"Dan Rogers" wrote:
> >
> >> I'm still confused about what you mean by async. How are you invoking
> them
> >> a) when it works, and b) when it doesn't work. Since you are returning
> >> values to the caller, I am pretty sure that these are not async server
> side
> >> operations, but you are referring to the non-blocking (beginMethodXX) on
> >> the caller side as "async".
> >>
> >> is this the case? If so, there is no difference in the way the call is
> >> dispatched and handled on the server side - so again, my confusion as to
> >> why the stream reader thinks the thread is async.
> >>
> >> Something in the description here (topology - e.g. what code are you
> trying
> >> to invoke on what side of a web service method call) is eluding me.
> >>
> >> Dan
> >> --------------------
> >> >Thread-Topic: Asynchronous Web Service Method Failure
> >> >thread-index: AcTi3k4zag4FdGNeSzOsg9ucQ1yLug==
> >> >X-WBNR-Posting-Host: 65.118.1.233
> >> >From: "=?Utf-8?B?VHVyYm8=?=" <Turbo@discussions.microsoft.com>
> >> >References: <4F6A0DC8-92A1-4BB9-9E07-43123A799944@microsoft.com>
> >> <00lXKSV4EHA.3388@cpmsftngxa10.phx.gbl>
> >> >Subject: RE: Asynchronous Web Service Method Failure
> >> >Date: Wed, 15 Dec 2004 11:43:09 -0800
> >> >Lines: 77
> >> >Message-ID: <E3D1275E-5CE8-4DCE-8145-0BAA1A0BE8EB@microsoft.com>
> >> >MIME-Version: 1.0
> >> >Content-Type: text/plain;
> >> > charset="Utf-8"
> >> >Content-Transfer-Encoding: 7bit
> >> >X-Newsreader: Microsoft CDO for Windows 2000
> >> >Content-Class: urn:content-classes:message
> >> >Importance: normal
> >> >Priority: normal
> >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> >> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
> >> >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
> >> >Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
> >> >Xref: cpmsftngxa10.phx.gbl
> >> microsoft.public.dotnet.framework.aspnet.webservices:27228
> >> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
> >> >
> >> >Here is the procedure. I call an asynchronous web service method for a
> >> >particular report. I don't pass any files, just parameters for the
> >> report,
> >> >such as start date and end date. The web service methods don't return
> any
> >> >files, just URL's to the files so I can execute a response.redirect
> when
> >> the
> >> >web service is done creating the report. Some of my reports are XML
> >> >spreadsheets, so to avoid have to create the XML from scratch, I use
> >> existing
> >> >files and then add the necessary data elements to them. Within the web
> >> >service method that is creating the report, I open a streamreader or
> use
> >> the
> >> >XMLDocument Load method in order to get the static XML loaded into the
> >> >XMLDocument. When I'm done, I use a streamwriter to create an
> >> XmlTextWriter
> >> >to save the document. These methods work fine when done synchronously,
> >> but
> >> >fail when done async. Only methods that use objects derived from
> >> >streamreaders and writers fail when run async. I hope I'm making
> myself
> >> >clear. The error message box that pops up only occurs during
> development.
> >>
> >> >It isn't a client issue.
> >> >
> >> >"Dan Rogers" wrote:
> >> >
> >> >> Some questions,
> >> >>
> >> >> When you say async - do you mean you have created a one-way SOAP
> method?
> >>
> >> >> (this is the right way to think about async for web services). When
> you
> >> >> have a one-way method, you don't get to write a response. In other
> >> words,
> >> >> async server side methods have a "void" signature always. If you try
> >> >> marking a non-void method with the one way soap attribute, that is an
> >> error.
> >> >>
> >> >> That aside, you should consider using SOAP with attachments if you
> are
> >> >> returning files (no longe async methods).
> >> >>
> >> >> I hope this helps
> >> >>
> >> >> Dan Rogers
> >> >> Microsoft Corporation
> >> >> --------------------
> >> >> >Thread-Topic: Asynchronous Web Service Method Failure
> >> >> >thread-index: AcTe/QkQd8iqbozvTCKTbAiYn3Wy0A==
> >> >> >X-WBNR-Posting-Host: 65.118.1.233
> >> >> >From: "=?Utf-8?B?VHVyYm8=?=" <Turbo@discussions.microsoft.com>
> >> >> >Subject: Asynchronous Web Service Method Failure
> >> >> >Date: Fri, 10 Dec 2004 13:13:03 -0800
> >> >> >Lines: 12
> >> >> >Message-ID: <4F6A0DC8-92A1-4BB9-9E07-43123A799944@microsoft.com>
> >> >> >MIME-Version: 1.0
> >> >> >Content-Type: text/plain;
> >> >> > charset="Utf-8"
> >> >> >Content-Transfer-Encoding: 7bit
> >> >> >X-Newsreader: Microsoft CDO for Windows 2000
> >> >> >Content-Class: urn:content-classes:message
> >> >> >Importance: normal
> >> >> >Priority: normal
> >> >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> >> >> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
> >> >> >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
> >> >> >Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
> >> >> >Xref: cpmsftngxa10.phx.gbl
> >> >> microsoft.public.dotnet.framework.aspnet.webservices:27146
> >> >> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
> >> >> >
> >> >> >Greetings to all
> >> >> >
> >> >> >I have a set of web services that create reports upon request.
> These
> >> >> >reports can take the form of XML Spreadsheets or dynamically
> generated
> >> >> .pdf
> >> >> >files. I call the create report methods async to give the user the
> >> >> >opportunity to cancel a long running report. However, any create
> >> report
> >> >> >method that opens a stream reader (in order to import some XML for a
> >> >> >spread***) or writer (in order to generate the XML spread***
> file)
> >> >> cannot
> >> >> >be run async. They run fine synchronously, but for some reason,
> >> opening
> >> >> an
> >> >> >IO.Stream causes a "there was an error during async processing"
> error.
> >> >> The
> >> >> >interesting thing is, this error is given in a message box, not a
> >> typical
> >> >> >ASP.NET error page. Any thoughts?
> >> >> >
> >> >>
> >> >>
> >> >
> >>
> >>
> >
>
>
- Next message: Fred Herring: "RE: Creating New Web Service"
- Previous message: AndyMalakov: "Re: wsdl.exe does not support mime:mimeXml as input encoding?"
- In reply to: Dan Rogers: "RE: Asynchronous Web Service Method Failure"
- Next in thread: Dan Rogers: "RE: Asynchronous Web Service Method Failure"
- Reply: Dan Rogers: "RE: Asynchronous Web Service Method Failure"
- Reply: Bruce Johnson: "RE: Asynchronous Web Service Method Failure"
- Messages sorted by: [ date ] [ thread ]