RE: Web Service throws exception during Application_Start
From: Dan Rogers (danro_at_microsoft.com)
Date: 12/15/04
- Next message: Felix González: "server unabaible"
- Previous message: Dan Rogers: "RE: RowState Stored?"
- In reply to: fm_at_newsgroups.nospam: "RE: Web Service throws exception during Application_Start"
- Next in thread: fm_at_newsgroups.nospam: "RE: Web Service throws exception during Application_Start"
- Reply: fm_at_newsgroups.nospam: "RE: Web Service throws exception during Application_Start"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Dec 2004 01:32:50 GMT
Have you considered using the config classes that are provided as part of
the WS stack? These are cached on start for you, so that if you access a
config value from within a web method, you get the cached value. If you
later change the web.config file, the service is restarted for you, so
subsequent calls see the new values.
There is no provision for redirecting config to some other non-file based
persistence mechanism at this point. But if you try out what is already
provided, I think you'll find it does the trick. The added value is that
if there is a config parsing problem, the application WON'T start properly
(an error is returned to any call).
I hope this helps
Dan Rogers
Microsoft Corporation
--------------------
>Thread-Topic: Web Service throws exception during Application_Start
>thread-index: AcTh+KYtwFXLsmnJSxeJxQNORAN7uw==
>X-WBNR-Posting-Host: 192.41.148.220
>From: "=?Utf-8?B?Zm1AbmV3c2dyb3Vwcy5ub3NwYW0=?=" <fm@newsgroups.nospam>
>References: <649FEFA7-EF0F-4ABB-9A92-02A64D685530@microsoft.com>
<dwifcgV4EHA.3440@cpmsftngxa10.phx.gbl>
>Subject: RE: Web Service throws exception during Application_Start
>Date: Tue, 14 Dec 2004 08:19:12 -0800
>Lines: 85
>Message-ID: <70149971-4270-49A3-B95A-0E4F823AE213@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:27188
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
>During application startup, we are loading static values from web.config.
We
>expose those values to the rest of the application as shared properties in
>the Global class. This is to be consistent with our ASP.NET web
applications.
>I suppose we could load these values on session start for web services but
>that seems like a lot of extra processing during runtime. Perhaps with web
>services we should have the code call our web.config wrapper methods
>directly. But then you loose that layer of abstraction if we move the
>location of those values (to a database or other data store).
>
>The only times this logic should bomb is if web.config does not match what
>the code is trying to read (that is how I discovered this problem). But
the
>fact is it could still error out. I think one thing I will investigate is
>throwing a hand-written SOAP envelope (does not sound too pretty either).
>
>
>
>"Dan Rogers" wrote:
>
>> Something else you can do is change the auto-generated HTML page for
>> specific errors. By default, these are HTML, but you can change them
from
>> the IIS administration console.
>>
>> Since you are having this kind of problem I wonder why are you doing
>> applicaiton start kind of logic? In general, you want web services to
be
>> stateless. Using the application start feature implies you aren't
staying
>> statless - which may be a cause of frustration for you ongoing. The
>> application.start, session, etc are ASP programming model entities for
>> managing web sites and web page based applications (using a general tone
>> here - I'm sure that there are exceptions to the rule as always).
>>
>> Try NOT using applicaiton start for your web services....
>>
>> Regards
>>
>> Dan Rogers
>> Microsoft Corporation
>> --------------------
>> >Thread-Topic: Web Service throws exception during Application_Start
>> >thread-index: AcTfFIGVnDpe3DTaRYyAMlLJYzTwRg==
>> >X-WBNR-Posting-Host: 192.41.148.220
>> >From: "=?Utf-8?B?Zm1AbmV3c2dyb3Vwcy5ub3NwYW0=?=" <fm@newsgroups.nospam>
>> >Subject: Web Service throws exception during Application_Start
>> >Date: Fri, 10 Dec 2004 16:01:03 -0800
>> >Lines: 17
>> >Message-ID: <649FEFA7-EF0F-4ABB-9A92-02A64D685530@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:27147
>> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>> >
>> >We have some static information load from web.config during the
>> >application_start of our web service.
>> >
>> >However, if there is an error during this startup, the consumer gets
back
>> an
>> >ugly error message starting like: Client found response content type of
>> >'text/html; charset=utf-8', but expected 'text/xml'. The request failed
>> with
>> >the error message: --
>> >
>> >Errors in the Global class seem to step outside of the Soap Fault
>> standards.
>> >
>> >What is worse is that even though there is an error on Startup, the Web
>> >Service actually starts up. But of course the code in Application_Start
>> did
>> >not complete so now the Web Service is running in error.
>> >
>> >Am I correct or am I doing something wrong?
>> >
>> >fm
>> >
>>
>>
>
- Next message: Felix González: "server unabaible"
- Previous message: Dan Rogers: "RE: RowState Stored?"
- In reply to: fm_at_newsgroups.nospam: "RE: Web Service throws exception during Application_Start"
- Next in thread: fm_at_newsgroups.nospam: "RE: Web Service throws exception during Application_Start"
- Reply: fm_at_newsgroups.nospam: "RE: Web Service throws exception during Application_Start"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|