Web Service throws exception during Application_Start

Discussion in 'ASP .Net Web Services' started by fm@newsgroups.nospam, Dec 11, 2004.

  1. Guest

    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
     
    , Dec 11, 2004
    #1
    1. Advertising

  2. Mujtaba Syed Guest

    ASMX web services use the ASP.NET pipeline. If there is an error in
    Application_Start, it will be returned to the client as an IIS error page.
    One workaround is that you could trap all errors in Application_Error and
    "hand-write" a SOAP envelope with an appropriate SOAP fault to the response.

    Mujtaba.

    <> wrote in message
    news:...
    > 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
     
    Mujtaba Syed, Dec 13, 2004
    #2
    1. Advertising

  3. Dan Rogers Guest

    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=?=" <>
    >Subject: Web Service throws exception during Application_Start
    >Date: Fri, 10 Dec 2004 16:01:03 -0800
    >Lines: 17
    >Message-ID: <>
    >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
    >
     
    Dan Rogers, Dec 13, 2004
    #3
  4. Guest

    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=?=" <>
    > >Subject: Web Service throws exception during Application_Start
    > >Date: Fri, 10 Dec 2004 16:01:03 -0800
    > >Lines: 17
    > >Message-ID: <>
    > >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
    > >

    >
    >
     
    , Dec 14, 2004
    #4
  5. Mujtaba Syed Guest

    Hi:

    One solution could be to have a singleton-instance class that loads all the
    properties. The constructor of that class reads the web.config and has
    public properties that exposes those settings. And in all web methods that
    you want to use the configuration key/value pairs, you get hold of that
    singleton instance and invoke properties on it. The *first call to any web
    method* will do the *actual loading from web.config* and incase there is an
    error, it will go as a SOAP fault.

    Hope this helps,
    Mujtaba.

    <> wrote in message
    news:...
    > 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=?=" <>
    > > >Subject: Web Service throws exception during Application_Start
    > > >Date: Fri, 10 Dec 2004 16:01:03 -0800
    > > >Lines: 17
    > > >Message-ID: <>
    > > >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
    > > >

    > >
    > >
     
    Mujtaba Syed, Dec 14, 2004
    #5
  6. Guest

    Thanks, I will consider that. Like a Global on top of a Global :)

    "Mujtaba Syed" wrote:

    > Hi:
    >
    > One solution could be to have a singleton-instance class that loads all the
    > properties. The constructor of that class reads the web.config and has
    > public properties that exposes those settings. And in all web methods that
    > you want to use the configuration key/value pairs, you get hold of that
    > singleton instance and invoke properties on it. The *first call to any web
    > method* will do the *actual loading from web.config* and incase there is an
    > error, it will go as a SOAP fault.
    >
    > Hope this helps,
    > Mujtaba.
    >
    > <> wrote in message
    > news:...
    > > 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=?=" <>
    > > > >Subject: Web Service throws exception during Application_Start
    > > > >Date: Fri, 10 Dec 2004 16:01:03 -0800
    > > > >Lines: 17
    > > > >Message-ID: <>
    > > > >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
    > > > >
    > > >
    > > >

    >
    >
    >
     
    , Dec 14, 2004
    #6
  7. Dan Rogers Guest

    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=?=" <>
    >References: <>

    <>
    >Subject: RE: Web Service throws exception during Application_Start
    >Date: Tue, 14 Dec 2004 08:19:12 -0800
    >Lines: 85
    >Message-ID: <>
    >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=?=" <>
    >> >Subject: Web Service throws exception during Application_Start
    >> >Date: Fri, 10 Dec 2004 16:01:03 -0800
    >> >Lines: 17
    >> >Message-ID: <>
    >> >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
    >> >

    >>
    >>

    >
     
    Dan Rogers, Dec 15, 2004
    #7
  8. Guest

    My understanding is that the only class to read appfrom web.config (which
    logically merges machine.config) is
    System.Configuration.ConfigurationSettings? We already use GetConfig and
    AppSettings. We use this class to populate shared Global properties.

    Where we are getting the data from was not the issue, just the timing of it.
    Loading application state at Application_Start sounds like a bad spot in an
    ASP.NET WebService even though it is fine in an ASP.NET Web Application.

    We'll make do.

    "Dan Rogers" wrote:

    > 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=?=" <>
    > >References: <>

    > <>
    > >Subject: RE: Web Service throws exception during Application_Start
    > >Date: Tue, 14 Dec 2004 08:19:12 -0800
    > >Lines: 85
    > >Message-ID: <>
    > >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=?=" <>
    > >> >Subject: Web Service throws exception during Application_Start
    > >> >Date: Fri, 10 Dec 2004 16:01:03 -0800
    > >> >Lines: 17
    > >> >Message-ID: <>
    > >> >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
    > >> >
    > >>
    > >>

    > >

    >
    >
     
    , Dec 15, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. frog
    Replies:
    4
    Views:
    736
    =?Utf-8?B?V2lsbA==?=
    May 18, 2005
  2. Chris
    Replies:
    0
    Views:
    359
    Chris
    Jan 31, 2007
  3. Jordan S.
    Replies:
    3
    Views:
    869
    Juan T. Llibre
    Apr 19, 2008
  4. Chris Bardon

    Web Service Calling a COM object-throws exception.

    Chris Bardon, Jun 8, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    133
    Michelle Hlaing
    Feb 28, 2005
  5. frog
    Replies:
    0
    Views:
    131
Loading...

Share This Page