Re: Problem referencing web service

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: John Saunders (johnwsaundersiii_at_notcoldmail.com)
Date: 07/21/04


Date: Wed, 21 Jul 2004 14:02:58 -0400


"John" <john@nospam.infovis.co.uk> wrote in message
news:%23Nn%23Hf0bEHA.3012@tk2msftngp13.phx.gbl...
> It is my web service and it works fine on my local server. Just doesn't
work
> when uploaded to the remote server. I have now tried a very simple project
> (posted under separate thread) which also does not work at the remote
server
> but I can not see any error message to figure out what to do.

You should be trapping your errors in one way or another. Do you have a
handler for the Error event in global.asax? It could trap the error and then
write it out somewhere.

Given that this is a web service, you'd probably want to write the error to
the system event log. You'll want to create a
System.Diagnostics.EventLogTraceListener in Application_Start, and add it to
the System.Diagnostics.Trace.Listeners collection. Then, in the Error
handler, you can use
"System.Diagnostics.Trace.WriteLine(Server.GetLastError().ToString())".

The only complication is that the event source must already exist, as the
ASPNET account by default has enough privileges to write an event, but not
enough to create a new event source. You would want to create an event log
installer first. Here's what you do:

1. Open global.asax _in the designer_
2. From the toolbox, drag an EventLog component (from the Components tab)
onto the design surface.
3. With the new event log selected, use the Property browser to set the Log
and Source properties. You should set the Log to "Application" and the
Source to one of your choice, perhaps the name of the Web Service.
4. If you right-click the event log component, you'll see a menu choice for
"Add Installer". Select this. This will add an appropriately-configured
event log installer to your project.
5. Build your web service

Now, after deploying the new web service assembly to your remote server,
you'll have to run the installutil utility against the new assembly, on the
remote server. For instance, use Terminal Services to connect to the remote
server, then use a command prompt to connect to the bin directory of your
web service and enter the command:

installutil -i <webServiceAssembly>.dll

That will run the event log installer to install the event source, and your
web service should be able to write to it. Note that you will only need to
run installutil if the event log installer properties change, or if you want
to remove the event log source.

I hope that helps.

-- 
John Saunders
johnwsaundersiii at hotmail
> "Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
> news:euFkja0bEHA.3096@tk2msftngp13.phx.gbl...
> > On 7/20/2004 3:16 PM, John wrote:
> >
> > > Hi
> > >
> > > The same problem comes in a web browser. How can I check remotely,
where
> the
> > > error in web service is? It worked fine on my local server.
> > >
> > > Thanks
> > >
> > > Regards
> > >
> > >
> > > "Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
> > > news:%23KspJGpbEHA.2388@TK2MSFTNGP11.phx.gbl...
> > >
> > >>On 7/20/2004 1:41 PM, John wrote:
> > >>
> > >>>Hi
> > >>>
> > >>>I am trying to get web reference to my first (!) web service which is
> on
> > >
> > > a
> > >
> > >>>remote host. I am getting the following error;
> > >>>
> > >>>Server Error in '/' Application.
> > >>>
> > >>>Runtime Error
> > >>>Description: An application error occurred on the server. The current
> > >
> > > custom
> > >
> > >>>error settings for this application prevent the details of the
> > >
> > > application
> > >
> > >>>error from being viewed remotely (for security reasons). It could,
> > >
> > > however,
> > >
> > >>>be viewed by browsers running on the local server machine.
> > >>>
> > >>>How can I tackle this problem? I have the below web.config file.
> > >>>
> > >>>Thanks
> > >>>
> > >>>Regards
> > >>>
> > >>>
> > >>><?xml version="1.0" encoding="utf-8" ?>
> > >>><configuration>
> > >>>  <system.web>
> > >>>    <compilation defaultLanguage="vb" debug="true" />
> > >>>    <customErrors mode="Off" />
> > >>>    <authentication mode="None" />
> > >>>    <authorization>
> > >>>        <allow users="*" /> <!-- Allow all users -->
> > >>>    </authorization>
> > >>>    <trace enabled="true" requestLimit="10" pageOutput="true"
> > >>>traceMode="SortByTime" localOnly="true" />
> > >>>    <sessionState
> > >>>            mode="InProc"
> > >>>            stateConnectionString="tcpip=127.0.0.1:42424"
> > >>>     sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
> > >>>            cookieless="false"
> > >>>            timeout="20"
> > >>>    />
> > >>>    <globalization requestEncoding="utf-8" responseEncoding="utf-8"
/>
> > >>>  </system.web>
> > >>></configuration>
> > >>>
> > >>>
> > >>>
> > >>Are you sure it's not the web service on the other end w/ problems?
> > >>Sounds like they're throwing an exception on their end; are they a
.NET
> > >>webservice?  Cuz this error message could not be from your web.config
> > >>(you have custom errors off).   If it's a .NET webservice, and you can
> > >>browse to the .asmx URL in your web browser, try that and see if it
> > >>comes up w/ the documentation page.  You may not be able to do this as
> > >>they could disable that functionality.
> > >>
> > >>-- 
> > >>Craig Deelsnyder
> > >>Microsoft MVP - ASP/ASP.NET
> > >
> > >
> > >
> > Well, you can't, as I assume this is someone else's webservice?  The
> > reason is they have customErrors set to RemoteOnly in the service's
> > web.config, so you can't see the actual error unless you browse to it on
> > the server's browser itself.  I would contact whoever owns it and say
> > you're getting an error.  More than likely, something is erroring on
> > their side, causing you to not be able to use it.
> >
> > Otherwise, if it's your webservice on another box you control, goto that
> > box and browse the same way, or change customErrors to Off in the
> > webservice's web.config.
> >
> > -- 
> > Craig Deelsnyder
> > Microsoft MVP - ASP/ASP.NET
>
>


Relevant Pages

  • Re: IIS default install wont work - Bad Request all the time
    ... > Check the event log for entries related to this, ... > address of the server, check to see if the web service is running. ... Okay Web service is definitely running. ...
    (microsoft.public.inetserver.iis)
  • Re: Enterprise Logging does nothing on server
    ... Server, no new entries appear in the Application log after calls to ... When I first used this block, I couldn't write to the event log from a ... web service on my development machine. ... windows app to establish the category, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Win XP event log: Access denied
    ... You might try enabling some auditing on the server in question in Local ... Security Policy and setting the SACL on the event log files and registry ... I have a web service running on my ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Permissions for IIS 6.0 web site
    ... I have a Web service that needs to write to the application event log on W ... 2003 Server. ... Remove Spanish word for Spam when replying ...
    (microsoft.public.windows.server.security)
  • Re: What are the best general things to do after a dirty shutdown (Server SBS)
    ... Microsoft Windows Small Business Server 2003 Best Practices Analyzer ... After that, please post any event log errors, just the EventID# and Source names, not the whole error message. ... error 15100 Win32 Error 15100. ... One is indicating it can't retrieve info about the System log. ...
    (microsoft.public.windows.server.sbs)