Previously working webservice stopped working - asp.net

All of a sudden we started to get this error in our webapplication.
It's weird because it has been working for months and months and noone has ever touched the code.
Does anyone have any idea why this error could occur all of a sudden?
Server Error in '/' Application.
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindOne()
at AuthTools.GetUserMemberShip(String login) in D:\IIS\WWW_reports_WebServices\App_Code\AuthTools.vb:line 35

You are using some unmanaged COM object from your managed code. Could it be that this object changed? I.e. it's not your application, it's the unmanaged library you are using. I might be wrong, but that's all I can think of when looking at the stack trace.

Heh, it's a bit embarrassing but our webservice queries our active directory to find user groups, and due to a missconfiguration where a group had a member it was also a member of, our application ended up in an endless loop.

The .Net Framework BCL uses a lot of wrapper objects around legacy COM code to interact with ActiveDirectory and other LDAP sources. This can be caused by changed settings at the AD server, or there are issues with connection management to AD (are you properly closing your connections, for example.)
I would start investigating from the server-end and determine issues from there. The diagnostics/error-messages within the .Net Framework classes, because they bubble up through COM, aren't that helpful.

Related

Handling ASP.Net framework exceptions thrown by dependencies

My Azure .Net web app uses a shared cache role which can sometimes throw an exception meaning, "retry later" if it is hot swapping. Currently, that causes my web app to error. However, this is thrown before my app has even started up since it is the framework/IIS which has attempted to setup the cache and failed.
How can I catch these exceptions and do something useful when redirecting to an error page would still require my app and config/cache to load, which would cause the exceptions again? Even if I could catch the exception in Application_Error, I don't think I can retry the connection to the cache because I didn't create it in the first place.
Few questions :
Didn't clearly get your question. So it's your client calling cache, who is getting these errors right?
Are you using session state provider for cache? If not, When you said you are not making connections to the cache, what did you mean?
What is the exact error?
Is it intermittent? Is it always happening during role startup, the case u mentioned here?

Determine what is causing the error "This SqlTransaction has completed; it is no longer usable" error

We run a proprietary web based Finance system created in ASP.NET that is throwing the following error on a regular basis:-
Exception: System.InvalidOperationException
Message: This SqlTransaction has completed; it is no longer usable.
StackTrace: at System.Data.SqlClient.SqlTransaction.ZombieCheck()
at System.Data.SqlClient.SqlTransaction.Rollback()
at Agresso.Driver.Database.ManagedConnection.RollbackTransaction()
at Agresso.Driver.Database.ManagedConnection.Close()
at Agresso.Driver.Database.ManagedConnection.Dispose(Boolean isDisposing)
at Agresso.Driver.Database.ManagedDatabase.Dispose(Boolean isDisposing)
at Agresso.Driver.Database.DatabaseBase.Finalize()
The issue has been logged with the suppliers but they believe the error is due bespoke work that we have created ourselves.
What would you recommend as a way of determining what is causing the system to get into this state? We do not have access to debug the application but can run profiler on the database. However so far this has not shed any possible clues to what is causing the problem.
We are currently just restarting the app pool, which resolves the problem for a period of time before it occurs again.
Many thanks.
Pure speculation, but:
if DatabaseBase.Finalize() is a .NET finalizer, it shouldn't be attempting to dispose managed resources - so this may well be a bug in the DatabaseBase class finalizer.
However a finalizer for an IDisposable class is normally only called if the caller has failed to Dispose an instance of the class (the Dispose method usually calls GC.SuppressFinalize to prevent the finalizer from running).
I would start by looking at your own code that accesses the database, and make sure you call Dispose for all IDisposable types, typically by wrapping in a using block. FxCop / Visual Studio Code Analysis can help you identify places in your code where you're failing to do this.
This may well clear up the problem. If not, I suggest you try to create a minimal repro for the problem and contact the supplier again.

What is The remote server returned an error: (400) Bad Request?

I am trying to add contacts to the constant contact site n there i am getting following exception
The remote server returned an error: (400) Bad Request.
i am using ASp.net C# application for inserting my records.
can any one tell me the solution ,or why i am getting the above error?
Thanks in advance
This website is useful.
Introduction:
Why I am getting this exception? What is the cause of this error. Developers are always curious to know the root cause of an
exception, even though they found the solution from elsewhere. So what
is the reason of this exception (400 Bad Request).The answer is
security. Security is an important feature for any application.
ASP.NET try to his best to give you more secure application
environment as possible. One important security feature is related to
URLs. Because there are various ways a hacker can try to access server
resource. Therefore it is important to make your application as secure
as possible. Fortunately, ASP.NET provides this security by throwing
an exception of Bad Request whenever he feels. In this Article I am
try to present when ASP.NET feels to throw this exception. You will
also see some new ASP.NET 4 features which gives developers some
control on this situation.

How can I find out more diagnostic information from a failed web service call?

When calling an asp.net web service from a windows mobile device project, I am catching an exception ( WebException ) and the response inside that seems to be "BadRequest".
This is occurring on a live system but not locally in development. But they both have the same build....
When we point our development code at the live web service we get the BadRequest error again. Is there any way I can get more information about this error?
We use Elmah for logging and can confirm no exceptions are being thrown in the web service itself, in fact, it isn't even getting invoked!
Bad Request is a generic error which means the server didn't even bother looking much at the request from the client because it was significantly malformed in some way (service receive buffer lengths exceeded, etc.).
Try to send the server something simpler from the client until it works and/or gives a different (more precise) error.
Unfortunately, server exception handling or viewing traffic on the wire with a tool like Fiddler is probably not going to be helpful in this scenario.
It would help to know which version of web services this is (ASP.NET 2.0, WCF, etc.).

Webservice unavailable

I have an ASP.NET C# 3.5 web application that consumes another ASP.NET web service as a web reference. The web service is built into some proprietary hardware device. The problem is that that device has been having troubles and not alwasy accessible. My web application is suffering brcause of it, as it takes over a minute to load. It does load, but not acceptable.
The service is instantiated in a try catch block and no exception is being throw, but the output windows displays:
A first chance exception of type 'System.Net.WebException' occurred in System.dll
I know there is a better way to handle this, but I am drawing blanks.
Any help is appreciated.
UPDATE: Still looking for an answer on how to handle webservices that become unavailable without affecting website.
After tearing it apart, I found the exception. It is a standard "Unable to connect" exception. The problem is now the timeout, I have tried setting the asyncTimeout to 5000 in the web.config under the System.Web -> Pages properties. It is still taking aroung 20 seconds to throw the exception. Any ideas?
If you saw a "first chance exception" but your exception handler didn't get it, that means that the exception was handled elsewhere (swallowed, consumed by an exception handler, etc.) Perhaps something in the .NET libraries already handled that exception, and you need not concern yourself with it in your code. Or maybe you left some exception swallowing somewhere in your code.
You ought to consider using a timeout in your web request.
Simple solution, poll the service using JavaScript after page load.
Without any details regarding frequency/usage of the service and not seeing any code, heres a thought or two.
Its most likely the web method on this hardware that giving the error, so I'd pursue any support options you have (if any), but just for giggles, try this first to see if it helps....
I noticed that some people online said that they were able to get around this (in their scenario) by setting the KeepAlive to false on the requesting object, so that way your aren't inadvertently using an old (stale) connection to the service. You may be trying to "Keep Alive" but the webserver timed out the connection on you. Worth a quick try...
Good Luck!
In addition to the above, I would use a http debugger (like fiddler2) to get a better idea of what is happening on the wire.

Resources