.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Webmethod interrupted

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net

Hi everyone,

  I'm using a static Webmethod in a PageMethod and have a question.  When my static Webmethod is called, I noticed that I can interrupt the call while it's working by clicking on an asp:Button, for instance.  Thus, whatever action the method was supposed to do never completes.  Is this normal or is there something special that needs to be done in order to avoid the user from doing this?  By the way, my static method is decorated like so.

public static void TagChange(int rIndex)
{ //work }

Please let me know if you need more info.  Thanks

View Complete Post

More Related Resource Links

Web Services: Extend the ASP.NET WebMethod Framework with Business Rules Validation


In an earlier article the authors showed how to build a custom WebMethods extension that provides XML Schema validation, a function that is lacking in ASP.NET. In the process they established a foundation for enforcing business rules during the deserialization of XML data. The technique, which is described in this article, uses declarative XPath assertions to test business rule compliance.In building this business rules validation engine, the authors integrate the validation descriptions into the WSDL file that is automatically generated by the WebMethod infrastructure. Finally, they demonstrate how to extend wsdl.exe, the tool that generates WebMethod proxy/server code from WSDL files, to make use of their extensions.

Aaron Skonnard and Dan Sullivan

MSDN Magazine August 2003

Web Services: Extend the ASP.NET WebMethod Framework by Adding XML Schema Validation


WebMethods make the development of XML Web Services easier by encapsulating a good deal of functionality, but there is still a lot of underlying XML processing that you have to be responsible for. For example, WebMethods do not validate messages against the implied schema. Because they are not validated, the response that's returned can result in unintended consequences. To address this, the authors extend the WebMethod framework by adding XML Schema validation through a custom SoapExtension class.

Aaron Skonnard and Dan Sullivan

MSDN Magazine July 2003

JQuery and WebMethod asp.net validations

i am using jquery and passing my data to webmethod,but asp.net validation are not performing their desired action on button click,if i enter wrong data,they still post the data,how i m going to stop that??? 

InvalidOperationException error with jquery call to webmethod

Hi, I'm having an issue which results in returning the following from XHR requests to an webmethod on my form. {"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}Simplified form Code is as follows. [WebMethod]        public string LoadContact()        {            return string.Format("Hello From Server");        }I'm using JQuery to make the call: $.ajax({            type: "POST",            url: "SYS_AjaxResearch.aspx/LoadContact",            data: "{}",            contentType: "application/json; charset=utf-8",            dataType: "json",            success: function(msg) {                $("#topPanel").text(msg.d.LoadContact);   

AJAX AutoCompleteExtender Not Calling WebMethod

I have the correct signature for the web method, and it works fine,  but for some reason it is not being called at all by AutoCompleteExtender<div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> <Services><asp:ServiceReference Path="~/AutoComplete.asmx" /></Services> </asp:ToolkitScriptManager> <asp:TextBox ID="txtUser" runat="server"></asp:TextBox> <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtUser" ServicePath="~/AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" EnableCaching="true" UseContextKey="false"> </asp:AutoCompleteExtender> </div>  Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Web.Script.Services Imports System.ComponentModel Imports System.Data.SqlClient ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ <System.Web.Services.WebServiceBinding(ConformsTo:=WsiP

InstancePersistenceCommand interrupted due to missing instance

  Hi I created a workflow service in which I have 2 RecieveAndSendReply activities that communicate on a single handle (initialized with a Query Correlation Initializer on the variable VacationId). When I run the workflow service WCFClient and execute the StartVacation service all works fine and I get response as expected. After that I execute the ProcessVacation service with received VacationId, I get the following error:   The execution of an InstancePersistenceCommand was interrupted because the instance key '0abf323d-09a0-dcaa-8a37-1295507e9cd7' was not associated to an instance. This can occur because the instance or key has been cleaned up, or because the key is invalid. The key may be invalid if the message it was generated from was sent at the wrong time or contained incorrect correlation data. Server stack trace:    at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethro

Webmethod backgroundworker freezes client

Hi guys,I am writing a webservice which has to perform a long running job. It is a requirement that I call the webmethod synchronously but the webmethod executes another method asynchronously and returns to the client. So I used a background worker on the webmethod to run and I call it asynchronously, then the method returns. Unfortunately the client still waits until the backgroundworker is completed.Below is a sample code to simulate the problem:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Services;using System.ComponentModel;namespace BackgroundWorkerTest{    /// <summary>    /// Summary description for Service1    /// </summary>    [WebService(Namespace = "http://tempuri.org/")]    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]    [System.ComponentModel.ToolboxItem(false)]    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.     // [System.Web.Script.Services.ScriptService]    public class Service1 : System.Web.Services.WebService    {        BackgroundWorker bkgW = null;        [WebMethod]    &n

The execution of an InstancePersistenceCommand was interrupted because the instance is already compl

Hi, From the appfabric dashboard, sometime I see the following error on my workflow services: Can some body tell me what is this error mean? Thanks, cd4 System.ServiceModel.FaultException: The execution of an InstancePersistenceCommand was interrupted because the instance 'c4d192bb-c0e2-4ee4-80b1-f1deef9788ae' is already complete.    at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)    at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult.End(Object[]& outputs, IAsyncResult result)    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeEnd(MessageRpc& rpc)    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage7(MessageRpc& rpc)    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

Returning DataSet/Datatable from Webmethod to Javascript

I have a simple web method written in the code-behind (not a separate asmx) of a test aspx page. All it does is return a DataTable(or DataSet) both are failing, gives a blank 500 error saying "There was an error processing the request" If I switch the return variable type to String, it works fine I think my issue has to do with the version of the System.Web.Extensions, is that the assembly that actually contains the JSON communication implementation? I've read all kinds of tutorials about how it should be possible to return the DataTable to javascript and then read the properties with javascript syntax. For some reason it isn't working for me. My web extensions is imported through my web.config with the following version <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Multiple call to same webmethod in same call.. Urgent help

INFO: IIS 7+ .NET 4.0 I have a webservice with a webmethod [WebMethod] public string InsertUpdateCategory(string Language, int Parent, int Id, string Name, bool DeleteOnWeb)   I call it with<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header/> <soap:Body> <InsertUpdateCategory xmlns="hidden"> <Language>EN</Language> <Id>5</Id> <Parent>0</Parent> <Name>TrÃ¥d EN</Name> <DeleteOnWeb>true</DeleteOnWeb> </InsertUpdateCategory> <InsertUpdateCategory xmlns="hidden"> <Language>EN</Language> <Id>6</Id> <Parent>0</Parent> <Name>Ting to</Name> <DeleteOnWeb>true</DeleteOnWeb> </InsertUpdateCategory> </soap:Body> </soap:Envelope> But the "InsertUpdateCategory" only execute the last part of the call specified (the one with Id 6), the first don't get executed

Simple return value from WebMethod from Ajax function using JQuery


I have an Ajax function called from JQuery that goes to a webservice to return a value.  I need a SIMPLE example on how I can do this.  I've been going nuts with serializing and every other aspect of this topic. 

I need to return either an ArrayList with ONE string field or a DataTable of some kind.  Either way, I'm populating it into a DropDownList.

I'm willing to consider alternatives to this idea. (Background info - I get a value from a textbox and I need to run it through a DB to get an associated value or set of values).  I'm being really general so that someone can show a simple example.  Thanks.

Getting "401 Unauthorized" error with jquery call to webmethod


Hello folks,

I have been struggling to get my jquery call to a webmethod to work. I am being bounced by the server with a "401 Unauthorized" response. I must have an incorrect setting in the web.config or somewhere else that would be preventing a successful call.


How to obtain URL inside a WebMethod in .NET Web Service?


  <WebMethod(Description:="Tests the authentication of a given set of user credentials..")> _
  Public Function AuthenticateUser(ByVal strEmailAddress As String, ByVal strPassword As String, ByVal strSubmitterID As String) As String
    Dim strResult As String = "OK"
    Dim intUserProfile As Integer = 0
    Dim intCompanyProfile As Integer = 0
    Dim objSqlConn As DataConnection

Use WebMethod in UserControl


Does anyone know if it is possible to use a WebMethod in a UserControl?

Lets say for example that I have an test.ascx file with the following method:

Imports System.Web.Services
Imports System.Web.Script.Services

    <WebMethod(), ScriptMethod()> _
    Public Sub ShowMessage()
    End Sub

In the Page_Load of the .ascx file I add some JavaScript which will do the following:

jQuery(document).ready(function() {
    $("#btnTest").click(function() {
        $.ajax( {
            type: "POST",
            url: "test.ascx/ShowMessage",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",

Couple of soap errors on invoking a webmethod in ASPNet web services


Hi there!!

I am consuming an ASP.Net webservice from a simple .Net application by
adding a web reference. However when I invoke the web method, we see a
couple of soap error entries in the application event log with the
result that the http request is not successfully completed.

We even tried to invoke the web method directly from the asmx page in
IE providing in the required parameters. We still get the same errors.

Please note this problem is intermittent and does not happend

The following are the event log entries:

Soap error: XML Parser failed at linenumber 0, lineposition 0, reason
is: The download of the specified resource has failed.
Soap error: Soap client is not initialized.
Soap error: One of the parameters supplied is invalid..
Soap error: Loading of the WSDL file failed.

Sometimes we get a little different kind of event log entries as given

aspnet_wp.exe  (PID: 2228) stopped unexpectedly.
Soap error: One of the parameters supplied is invalid..

Soap error: Loading of the WSDL file failed.

Soap error: XML Parser failed at linenumber 0, lineposition 0, reason
The system cannot locate the object specified.

We fail to understand as to where is the problem. We can easily browse
to the wsdl file successful

Reporting Services Add in for SharePoint - Installation Interrupted


I am trying to install the 'Reporting Services Add-In for SharePoint'. And for some strange reason, its rolling back the installation at the last step and showing me the message saying 'The Reporting Services Add in set up was interrupted. Your system was not modified, please run the set up again'. I tried googling for any solutions, but everyone is saying I should look in the 'Documents and Settings -> temp' folder for the installation log file which would tell me the cause of the error, but as luck would have it, im not able to find that file as well (there are no files in temp, and the log is not getting created there).. I tried the 'msiexec *i' option, but was not able to find anything useful there.


Any pointers towards solving this issue would be greatly appreciated.




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend