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


Top 5 Contributors of the Month
david stephan
Post New Web Links

Send/open timeouts on WAS-hosted WCF service with named pipe orTCP binding, per-call instancing

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :WCF
 
We have a client that sends requests to a per-call WCF service (WAS hosted, NP binding, same machine) in a loop. The WCF service calls an external EXE to process requests. The operations on the service can take a few seconds, or a few hours. To combat this, we have sendTimeout=00:05:00, receiveTimeout=00:05:00 and a built-in circuit-breaker on the service that kills the external process after 00:05:00. Any service-side errors are returned to the client as FaultExceptions.  On the client, FaultExceptions are logged and the client proxy is aborted (proxy.Abort()). The client has configurable multithreading. In this example, it is running 3 threads, each of which creates a proxy, makes a call, and closes the proxy (or aborts it if an exception was received). Since the service is instanced as per-call, and it never receives more than 3 simultaneous calls (each of which being followed by a .Close() or .Abort() on the proxy), I would not expect the client to be getting timeouts during the send, but I am. In fact, the send timeouts I am receiving would seem to imply that the WCF service is hitting the default session limit, even though the class is explicitly marked with [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]. I put some trace logging on the client and I can see that the timeout is occurring when the proxy is being created. sendTimeout seems to


View Complete Post


More Related Resource Links

WCF web service hosted in Sharepoint 2010 is called TWICE for a single client call. WHY??

  

We have WCF SOAP web service hosted in Sharepoint 2010 using service factory method and observe behavior which we cannot explain.

When authenticated web client invokes our service method “Generate” (synchronously) it is first get called with Anonymous credentials (SPContext.Current.Web.CurrentUser == null). Anonymous users don’t have enough permissions, so the first attempt of the service method to access a folder (SPContext.Current.Web. GetFolder("Shared Documents")) throws ThreadAbortException. But control does not return to the client. Instead the service method gets called AGAIN, now with correctly set SPContext.Current.Web.CurrentUser. Nowit works successfully to the end and result returns to the client.

 

The question which puzzles us a lot is WHY the service is called first time with Anonymous creds? We’d rather avoid this first invocation if possible.

WCF web service hosted in Sharepoint 2010 is called TWICE for a single client call. WHY??

  

We have WCF SOAP web service hosted in Sharepoint 2010 using service factory method and observe behavior which we cannot explain.

When authenticated web client invokes our service method “Generate” (synchronously) it is first get called with Anonymous credentials (SPContext.Current.Web.CurrentUser == null). Anonymous users don’t have enough permissions, so the first attempt of the service method to access a folder (SPContext.Current.Web. GetFolder("Shared Documents")) throws ThreadAbortException. But control does not return to the client. Instead the service method gets called AGAIN, now with correctly set SPContext.Current.Web.CurrentUser. Nowit works successfully to the end and result returns to the client.

 

The question which puzzles us a lot is WHY the service is called first time with Anonymous creds? We’d rather avoid this first invocation if possible.

How to call and open pop up window to send email

  

Hi I'm looking to add a pop window to my app the is called when press email heres my code.

Please advise novice :)

 

///main xaml

<Window x:Class="PetFile.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="450" Width="325">
  <DockPanel>
    <Menu Name="menu1" DockPanel.Dock="Top">
      <MenuItem Header="_File">
        <MenuItem Header="_Load Data" x:Name="mnuLoad" Click="mnuLoad_Click" InputGestureText="Ctrl+L"></MenuItem>
        <MenuItem Header="_Save Data"></MenuItem>
      </MenuItem>
      <MenuItem Header="_Quit!" x:Name="mnuQuit" Click="mnuQuit_Click"/>
    </Menu>
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="2*"></ColumnDefinition>
        <ColumnDefinition Width="4*"></ColumnDefinition>
      </Grid.ColumnDefinitions>
      <!-- DisplayMemberPath ensures the pet_Name property is used to display a Pet in the listbox -->
      <ListBox x:Name="lbxPets" Se

Web Service that will receive xml request and send xml response

  


I am trying to create a web service that can do the following functionality:

Request XML 

<?xml version="1.0" encoding="UTF-8"?>
<Authentication UserName="test" Password="test" MyId="0987">
     <Function>1</Function>
</Authentication>


Response XML - After authenticating request xml from client send them back the following response:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
   <Test MyId="0987">
       <TestType id="11"></TestType>
       <TestType id="22"></TestType>
   </Test>
</Response>


How can I create web service to do this.



Invalid web service call, missing value for parameter: \u0027prefixo\u0027 (AutoCompleteExtender)

  

Good afternoon.

I'm trying to put an AutoCompleteExtender working, but i'm having an error, that i discovered with Fiddler, that is the reason that the autocomplete doesn't work:

> **{"Message":"Invalid web service call,
> missing value for parameter:
> \u0027prefixo\u0027."**,"StackTrace":"
> at
> System.Web.Script.Services.WebServiceMethodData.CallMethod(Object
> target, IDictionary`2 parameters)\r\n
> at
> System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object
> target, IDictionary`2 parameters)\r\n
> at
> System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext
> context, WebServiceMethodData
> methodData, IDictionary`2
> rawParams)\r\n at
> System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
> context, WebServiceMethodData
> methodData)","ExceptionType":"System.InvalidOperationException"}

This is the webservice code:

    Imports System.Web.Services
    Imports System.Web.Services.Protocols
    Imports System.ComponentModel
    Imports GcpBE750
    Imports ErpBS750
    Imports StdBE750
    
    ' To allow this Web Service to be called fro

make json call to send an email

  

the aspx:

<div class="contactSubmit">
                <asp:ImageButton ID="ibSubmit" runat="server" ValidationGroup="vgContact" /></div>


 

the jquery :

$(document).ready(function () {
            // Add the page method call as an onclick handler for the div.
            $(".contactSubmit").click(function () {
                $.ajax({
                    type: "POST",
                    url: "Home.aspx/GetDate",
                    data: "{}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (msg) {
                        // Replace the div's content with the page method's return.
                        $(".contactSubmit").text(msg.d);
                    }
                });
            });
        });


The problem is that I need to use the text in a text box in my webmethod, and I can't because it's static, this results in a compilation error:

[WebMethod]
    public static string SendContactForm()
    {
        Mail.SendMailMessage(NameTextBox.Text);
    }

<

Error Consuming Web Service - Unable to import binding xxx from namespace ...

  

In VS2008 / C# / ASP.NET 3.5, I wrote a test web service app. Here is an extract from the code:

namespace emed.MathWebService
{
    /// <summary>
    /// Sample Math Services For Learning Web Services Deployment
    /// </summary>
    [WebService(Namespace = " http://localhost/MathService")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class MathService
    {
        [WebMethod]
        public float Add(float a, float b)
        {
            return a + b;
        }  

.......

I have published this to an IIS virtual directory named MathService, and when I try to launch it with the URL http://localhost/mathservice/MathService.asmx is works fine and displays all the operations (Add, Subtract etc) in the service.

I then created a test web application in VS2008 (named WebSvcTe

Cash Drawer - Method Open threw an exception - Windows Service

  
Hi All, I'm getting the following exception while calling Open method of Cash Drawer object. Method Open threw an exception.  Could not read the device name key's default value, or could not convert the Programmatic ID it holds into a valid Class ID. Code:   class Class1 { CashDrawer _uniCashDrawer1 = null; DeviceInfo cashDrawerDevice1 = null; PosExplorer posExplorer = new Microsoft.PointOfService.PosExplorer();   public void ClaimCashDrawer() { cashDrawerDevice1 = posExplorer.GetDevice("CashDrawer", "testDrawer"); if (cashDrawerDevice1 != null) { _uniCashDrawer1 = posExplorer.CreateInstance(cashDrawerDevice1) as CashDrawer; if (_uniCashDrawer1 != null) { _uniCashDrawer1.StatusUpdateEvent += new StatusUpdateEventHandler(UniCashDrawer1_StatusUpdateEvent); _uniCashDrawer1.Open(); _uniCashDrawer1.Claim(0); _uniCashDrawer1.DeviceEnabled = true; } } } }   Tha above code works fine if you put the code in WindowsApplication in all POS systems. The same is working if you put the code in Windows Service in all other POS systems. The same is not working if you put the code in Windows Service in Aures Galeo POS systems.  Thanks in advance. Ramakrishnan S

Trying to call an asmx web service from a test project

  
I am trying to create a proxy for an asmx web service. The only thing I find in Visual Studio 2008 is a service reference. How do I call an asmx web service with a service reference? Certified Geek. Professional Data dude.

Cannot get service reference for Net.tcp service hosted in IIS7

  
HiI've got a service that I want to host in IIS7. The service runs over net.tcp (currently without security), but I am unable to create a service reference to it, or call it, using the net.tcp protocol. My event log is populated with lots of errors related to ASP.NET and System.ServiceModel, 3.0.0.0The relevant services are installed and running (net.tcp port sharing service and net.tcp listener adapter).O/S : Window7 RTMDevStudio: 2008I publish the webservice to IIS7 and I get a valid page when navigating to the published .svc file (which tells me to use svtutil.exe and point it at the net.tcp endpoint).For that, I get this error :    The message could not be dispatched because the service at the endpoint address 'net.tcp://gedm-desktop.profiledc01.appdevelop.local/ManageAVMEP/ManageAVMAgent.svc/mex' is unavailable for the protocol of the address.Googling the problem leads me down several blind alleys :(I cannot determine what is causing the net.tcp listener to keep stopping? Everything is fine if I use the wsHttpBinding.Any tips or pointers to a course of action would be appreciated.ThanksGed My event log is full of errors (here is a sample) :-------An error occurred while trying to listen for the URL '/LM/W3SVC/1/ROOT/ManageAVMEP'. This worker process will be terminated. Sender Information: net.tcp Exception: System.ServiceModel.WasHos

Question about WCF Service hosted in Windows Service

  
Hi, I have little experience with WCF and working on a projet that requires WCF Service instance to run 24x7. After searching for a solution and reading about WCF, I think if I host it under Windows Service I can have a single instance of WCF Service running 24x7. Is this correct? I just successfully ran the MSDN sample project that hosts CalculatorService in Windows Service. I realized that Windows Service cannot communicate with WCF Service it is hosting (I do not have any experience with writing Windows Service). I wrote a test function (public) in Windows Service and tried to call it from WCF Service but it did not appear in the Intellisense list. Is my assumption correct or is there a way to establish communication between Windows Service and its hosted WCF Service? Thanks. kr

net.pipe binding and Pipe is being closed error.

  
Hi, I am using net named pipe binding for the communication. I have came across many blogs regarding the 'pipe is being closed' error. When pipe is inactive then it is getting closed. I have set is and every time out to max. But still I get this error. Even I set the IdleTimeout as below. Then also my connection get closed. namedPipeBinding.CreateBindingElements().Find<NamedPipeTransportBindingElement>().ConnectionPoolSettings.IdleTimeout = new TimeSpan(23,0,0,0); And at server side I have (as I see in many blogs suggestion to avoid the closing of pipe) namedPipeBinding.ReceiveTimeout = timeOut; Is there any specific reason for this? ThanksRegards, Nakul

Unable to call an asmx web service using windows authentication from a Service workflow

  
Hello, I need to use an existing asmx service from inside my service workflow and I am unable to call it. This asmx service is hosted in a web application with iis set to windows authentication, anonymous is not allowed. I need to send the authentication, only way seems too be using transport for basicHttpBindings. Every time I try to call the service I get an error saying that there is nothing listening to the url of the service generated automatically by VS when I added the Service Reference ? my web config <configuration> <configSections> </configSections> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <protocolMapping> <add scheme="http" binding="wsHttpBinding" bindingConfiguration="WindowsCreds" /> </protocolMapping> <bindings> <basicHttpBinding> <binding name="UtilitiesSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

How to set and map a Method in the Service file with endpoint elements and binding elements

  
Hi all, I have created a service file like OSService.svc in that i have two methods like one is FileUpload and FileDownload for e.g :- [WebInvoke(UriTemplate = "/fileupload/{fileName}" , Method = "POST" )]         [OperationContract]         void FileUpload(string fileName, Stream fileContents); same as Filedownload also. People you may know these methods are inside the interface of service file what you are using i'e i have created a interface as IOSService.cs. So, what i need now is i want to write separate endpoint for FileUpload and Filedownload.Because i want to set separate value for receiveTimeout  and openTimeout for the Fileupload and FileDownload process in binding section in the web.config file itself. The below code was i'm using right now but still i'm not able to the set separate value of endpoint elements in the bindings. EndPoint Section:- <endpoint name = "endPoint1"  address  = "localhost:8000/OSService.svc/" bindingConfiguration = "TransactionalTCP"   binding  = "netTcpBinding"          contract = "IOSService"/> Binding Section:-  <binding name = "TransactionalTCP"  transactionFlow = "true"   /&

Client and service binding mismatch?

  
I have a WCF web service that when I call I get an exception: Content Type text/xml; charset=utf-8 was sent to a service expecting application/soap+xml; charset=utf-8.  The client and service bindings may be mismatched. It seems that only difference is text/xml needs to be changed to 'application/soap+xml'. Any ideas on how to fix this? The service is self-hosted (console host). The service reference was generated from this service without a problem. Thank you. Kevin

Duplex communication and calling clients from outside the hosted service

  
Hey,   I am currently building an interface between two applications: One that hosts a WCF service and receives external input (e.g. from a sensory system) and another which subscribes to updates sent by the first.   It is quite easy to call back to the client if I create a ServiceHost and provide it with an instance of my service (using ServiceHost.SingletonInstance). However, if I use a PerSession instance mode, how is it possible to call the clients when I receive an updated from the external sensory system?   Thank you for your time!   Cheers, Till

SharePoint ASPX Web Service Call Error

  
I have developed an ASPX page using VS2005. This page simply queries a SharePoint list through a WSS web service using CAML and takes the results and populates a DataTable and binds it to a DataView. The code works perfect using VS2005 but when I port it over to SharePoint I get the following error.Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.The call stack is as follows:[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]   System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 unrestrictedOverride, Int32 create) +0   System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark) +79   System.Security.CodeAccessPermission.Assert() +37   Book2Physical.Requests.get_DataSource() +
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