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


Post New Web Links

Abort() method of wcf client proxy doesn't release session after catching FaultException

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :WCF
 

Hello,

I have created a simple wcf service hosted in IIS and wcf client and figured out that when u catch a FaultException from the wcf service and then call client.Abort() to release the session (as the microsoft samples said) it doesn't release the session and hangs up on the 11th call.

Here is example:

Wcf Service:

[ServiceContract]   
public interface IService1 
{ 
    [OperationContract] 
    string GetData(int value); 
} 
 
 
public class Service1 : <


View Complete Post


More Related Resource Links

Abort() method of wcf client proxy doesn't release session after catching FaultException

  

Hello,

I have created a simple wcf service hosted in IIS and wcf client and figured out that when u catch a FaultException from the wcf service and then call client.Abort() to release the session (as the microsoft samples said) it doesn't release the session and hangs up on the 11th call.

Here is example:

Wcf Service:

[ServiceContract]   
public interface IService1 
{ 
    [OperationContract] 
    string GetData(int value); 
} 
 
 
public class Service1 : <

Why WCF client proxy doesn't contain Specified suffix?

  

I have a simple DataContract, with an int DataMember (X), I can see the minOccurs is 0 in the wsdl, when I generated client proxy, I was expecting to see a property with the Specified suffix (XSpecified), but it's not.

Also, when I use "Add web references", XSpecified is generated, when I use "Add service references", it's not.

The service is hosted in a Console Application.

I have been looking at this for quite a while, cannot find any clue, any help is appreciated.

C# code:

  [ServiceContract(Namespace = "http://localhost/Calc")]
  public interface ICalc
  {
    [OperationContract]
    int Add(AddInputs inputs);
  }

  [DataContract]
  public class AddInputs
  {
    [DataMember]
    public Int32 X { get; set; }

    [DataMember]
    public int Y { get; set; }
  }

  public class Calc : ICalc
  {
    public int Add(AddInputs inputs)
    {
      return inputs.X + inputs.Y;
    }
  }

Configuration:

 <system.serviceModel>
  <services>
   <service name="ServerApp.Calc" behaviorConfiguration="CalcBehavior">
    <host>
     <baseAddresses>
      <add baseAddress="http://NT60:8000/WCF1/Service"/>
     </baseAddresses>
    </host>
    <endpoint address="Calc&q

Why WCF client proxy doesn't contain Specified suffix?

  

I have a simple DataContract, with an int DataMember (X), I can see the minOccurs is 0 in the wsdl, when I generated client proxy, I was expecting to see a property with the Specified suffix (XSpecified), but it's not.

Also, when I use "Add web references", XSpecified is generated, when I use "Add service references", it's not.

The service is hosted in a Console Application.

I have been looking at this for quite a while, cannot find any clue, any help is appreciated.

C# code:

 [ServiceContract(Namespace = "http://localhost/Calc")]
 public interface ICalc
 {
  [OperationContract]
  int Add(AddInputs inputs);
 }

 [DataContract]
 public class AddInputs
 {
  [DataMember]
  public Int32 X { get; set; }

  [DataMember]
  public int Y { get; set; }
 }

 public class C

Why WCF client proxy doesn't contain Specified suffix?

  

I have a simple DataContract, with an int DataMember (X), I can see the minOccurs is 0 in the wsdl, when I generated client proxy, I was expecting to see a property with the Specified suffix (XSpecified), but it's not.

Also, when I use "Add web references", XSpecified is generated, when I use "Add service references", it's not.

The service is hosted in a Console Application.

I have been looking at this for quite a while, cannot find any clue, any help is appreciated.

C# code:

 [ServiceContract(Namespace = "http://localhost/Calc")]
 public interface ICalc
 {
  [OperationContract]
  int Add(AddInputs inputs);
 }

 [DataContract]
 public class AddInputs
 {
  [DataMember]
  public Int32 X { get; set; }

  [DataMember]
  public int Y { get; set; }
 }

 public class Calc : ICalc
 {
  public int Add(AddInputs inputs)
  {
   return inputs.X + inputs.Y;
  }
 }

Configuration:

 <system.serviceModel>
 <services>
  <service name="ServerApp.Calc" behaviorConfiguration="CalcBehavior">
  <host>
   <baseAddresses>
   <add baseAddress="http://NT60:8000/WCF1/Service"/>
   </baseAddresses>
  </host>
  <endpoint address="Calc" binding="wsHttpBinding" contract="ServerApp.ICalc&q

.NET4, DataGrid doesn't apply EditingElementStyle with ValidatesOnExceptions when catching an excep

  
Hello everyone, I'm using WPF and the .NET 4 framework (4.3.30319), on the Windows 7 32-bit OS. I wanted to keep things simple with validation and my property setter just throws an ArgumentException when the data is not valid, instead of implementing a ValidationRule class. While this worked with a ListBox, it seems it doesn't with a DataGrid. Below is a simple example to reproduce the problem, check the XAML and C# code related to the 2nd column. The datagridTBStyle is meant to apply a specific style when an error occurs (since control templates are out of the question with DataGrid), but what I see is: it applies the correct style when editing the cell (blue text) it doesn't apply the part that is supposed to trigger on Validation.HasError (red on yellow background + tooltip) Without this style, it doesn't apply a red border around the cell as it should according to the documentation. However, it does put a part of red exclamation mark in the row header when an error occurs, and it catches the exception. Am I doing something wrong, or is this actually a bug? Link to the documentation. <Window x:Class="DataGridTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test" Height="200" Width="350&q

Sys.Data.DataContext.saveChanges method doesn't send update to server after DataServiceException ex

  
Hello,I have a page with a simple form that updates a single record in a table in my database.The database is accessed via WCF Data Services. To load and save data from/to the server, I usethe Sys.Data.DataContext object provided by the ASP.NET AJAX library. When the "save" button on theform is clicked, I use the saveChanges method of the Sys.Data.DataContext object to send all changes to the server.Also, at the server side, I use an interceptor that checks the "Price" fields of the record, and throws a DataServiceException exception when the contents of the field is a negative number.Both the JavaScript and the interceptor (in C#) are copied below.Here is the interesting thing:When I enter a negative price in the form, the interceptor throws the exception and my form shows an error message. Good.However, if I then make one of the other fields in the form a bit shorter (for example from "abcd" to "abc"),the saveChanges method doesn't send the data to the server. But it does call the success callback that I passed in to saveChanges, creating the impressionthat the data has been saved. This happens while the Price field is still negative. I used Fiddler to make sure thatno message is sent to the server. Also, the interceptor doesn't get executed.The weird thing is that if I make one of the fields a bit longer instead (for example &q

WCF WebGet method doesn't work from browser

  
I'm trying to operate a WCF Method from the browser, i opened a basic WCF Project and added the Webget attribute, my interface is this: [ServiceContract] public interface IService1 { [WebGet(UriTemplate = "GetData?value={value}", BodyStyle = WebMessageBodyStyle.Bare)] [OperationContract] string GetData(int value); [OperationContract] CompositeType GetDataUsingDataContract(CompositeType composite); // TODO: Add your service operations here } and i'm inserting the following URL in the Browser: http://localhost:3122/Service1.svc/GetData?value=3 i get "The webpage cannot be found" there must be missing something in my configuration , what do i have to add ? this is my configuration : <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing

WCF proxy generation encapsulates original method using MessageContracts

  
I am having an issue generating the client proxy for a set of WCF services. I am sending a MessageContract as a parameter to the service and returning a MessageContract. The generated proxy has the resulting method as private and generates another public method that accepts all the properties of the message as individual parameters, then assembles the MessageContract, and calls the private method. I can’t seem to figure out how to get it to generate a proxy with original signature for the method.   My message contracts are thus:      [MessageContract(IsWrapped=false)]    public class FlashFileMessage    {       [MessageHeader]       public string Filename { get; set; }         [MessageHeader]       public long FileSize { get; set; }         [MessageBodyMember]       public Stream Data { get; set; }    }      [MessageContract(IsWrapped=false)]    public class TransferFileToInstrumentResponse    {       [MessageHeader]       public bool Success { get; set; }         [MessageBodyMember]       public string Message { get; set; } &n

How to call CodeBehind Method from Client Side

  
Hi forumers,How can we call a CodeBehind Method with Arguement from Client Side?Here is the idea: this wont work<script type='text/javascript"> function func(){ var str = 'Hello World'; var result = '<% =CodeBehindFunction( str ) %>' } </script>I have a variable "str" and has a value of "Hello World".. I want to pass the value of "str" to the CodeBehind Method which is "CodeBehindFunction(object obj)"..How can I accomplish this idea without the use of XMLhttprequest, is it possible?

The client was unable to reuse a session with SPID 58, which had been reset for connection pooling.

  
HI I am getting the below error on - Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86)   Apr  2 2010 15:53:02   Copyright (c) Microsoft Corporation  Standard Edition on Windows NT 6.0 <X64> (Build 6002: Service Pack 2) (WOW64)  ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 2010-09-08 14:34:08.81 spid58      Error: 18056, Severity: 20, State: 29. 2010-09-08 14:34:08.81 spid58      The client was unable to reuse a session with SPID 58, which had been reset for connection pooling. The failure ID is 29.  This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message. ----------------------------------------------------------------------------------------------------------------------------------------------------------------- I restart the IIS server and SQL server since then until today I haven't face similar error. However, I want to understand the reason for it and how to avoid such errors in future. Thanks

COM Server process compiled with /clr option doesn't unload itself from memory when last COM client

  
I created Visual C++ ATL project in VS2010, exe type, imlemented COM object, then added /clr option to project. Project uses other C# dlls (WCF service). When last COM client disconnects and last COM object instance destroys, WCF service stopped, my COM server process doesn't unload itself from memory. All managed threads in C# dll are background, COM object doesn't create threads. How can I unload server process? Thank you in advance. 

Why request parameter added to client side code in each method while using svcutil.exe

  
Hi, I am using WCF services in my project and want to call WCF methods asynchronously. I am hosting WCF service programmatically in windows app as follows svc = New ServiceHost(GetType(Service1), New Uri("net.tcp://localhost:8806/")) Dim svcMDB As New ServiceMetadataBehavior svc.Description.Behaviors.Add(svcMDB) svc.AddServiceEndpoint(GetType(Service1), New NetTcpBinding(), "MyBusiness/MyBusinessService/") svc.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "MyBusiness/MyBusinessService/mex") svc.Open() Me.Text = "Service started...." and I am generating client side proxy using svcutil.exe as follows. svcutil /n:net.tcp://localhost:8806/MyBusiness/MyBusinessService,MyService net.tcp://localhost:8806/MyBusiness/MyBusinessService/mex /a /language:vb   The result of this command is as :   Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152] Copyright (c) Microsoft Corporation.  All rights reserved.   Attempting to download metadata from 'net.tcp://localhost:8806/MyBusiness/MyBusi nessService/mex' using WS-Metadata Exchange. This URL does not support DISCO. Generating files... D:\Prabodh\New C2k\Test Projects\DataTableToArray\MyHost\bin\Debug\MyBusinessSer vice.vb D:

Reliable Session Retries under IIS 6.0 Causes Session to Abort on Longer Operations

  
We have a WCF application (it's actually a SyncFx application, but that is not really relevant) when uses reliable session and message level security. The scenario is: Session is started by service request with IsInitiating attribute. Dozens of service requests are sent from client to server with a typical response time of 1 second. A final service request is sent from the client to the server with a typical response time of somewhere between 2 and 10 seconds. Session is terminated by service request with Isterminating attribute set true. Nothing special there. Or so it seems. It works fine, so long as the service response time for the final request is less than about 2.5 seconds. Otherwise, it faults out during the final request, for example when the service response time is, say, 5 seconds. Here is what actually happens, as determined by full WCF tracing on both client and server side, when this was the only thing happening in IIS: The final request is sent from the client by WCF. The server IIS (6.0, the same w3wp process that received all of the prior requests for this session) receives the request and dispatches the service code to execute it. The service code starts to execute the request. After approximately 2.5 seconds of sending the original final request, having not received a HTTP response, the client WCF resends the final request. I presume this is &qu

IsAjaxRequest method doesn't work with some IE requests

  
Hey, I've just discovered that the X-Requested-With header in IE is always "XMLHttpRequest, XMLHttpRequest" instead of just "XMLHttpRequest". I found the reason in MicrosoftMvcAjax.debug.js at line 280 (MVC 2.0). Seems there is no need to add this header again as it is already done in Microsoft AJAX Library. And because of this IsAjaxRequest extension method doesn't work anymore if there is no X-Requested-With param in the request body. And this make X-Requested-With header useless in IE. In Firefox there is no problem as it doesn't append but replace the existing header value. Not tested in other browsers. Can someone from the MVC team comment on this? Thanks in advance.

Help!!! How to call javascript method in client template???

  

<script id="menuTemplate" type="text/html">
        <option value="${MenuId}" level="${Level}">
 ${Name} //call some js method here? </option> </script>

How to call javascript method in client template (http://github.com/jquery/jquery-tmpl)


Need help in Webservices.How to make external Web Services method call in case of proxy in Asp.net 2

  

How to make external Web Services method call in case of proxy in Asp.net 2.0? 

 

The scenario is I have webservice Client dll.Now when  i Invoke the One of the Method in Client.dll,its not sending the request to server bcz the system is blocked with Proxy settings.I need to know call this method by bypassing the Proxy settings.

@Note:The client.dll is in different location.we are trying to contact the server with this dll.but its not contacting

pls help .its deeply appreciated .

 

Thanks

 

 


Http proxy for SSL using relay method on chunked transfer

  

hi,

 

I'm working on a proxy application; everything works find but ssl connections. here is what i'm doing and the problem description:

The proxy detects Connect request from browser and starts to relay ssl traffic to an external server and then receives the answer then sends the response directly to browser:

The request: Browser Ssl request <--> proxy application <--> external proxy server <--> remote website

I could implement ssl data relay (without touching any byte of it), but it only works for images and a few html pages.

I've checked the transferred data with Wireshark and Fiddler, they reports that all the traffic is sent ok and the data size was ok. But browser only displays direct request to images. (e.g: https://a.fsdn.com/sf/images/develop/logo.png)

 

Here is my guess about the issue:

I'm buffering all response/request traffic, when buffering is done the app sends it to proxy server/browser. After one full day investigation i realized that the browser only receives the very first part of request for html pages. In my opinion it receives only first chunk of response (but the response in not sent in chunks!) this is what i guess though!

I'm using TcpListener for both Proxy App and Proxy Server.

Please help me through this; what should I do ? :(

Many

Categories: 
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