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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

.net Named Pipes question

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :.NET Framework

Hello everyone. 


I have two quick questions.


1. Is it posssible for the same thread to wait for two different pipes at the same time?

2. How can I handle situations where multiple client pipes want to connect to the same serever pipe. Is there an internal FIFO?






View Complete Post

More Related Resource Links

Newbie Question: Configuring WCF Service - Named Pipes Only for PubSub setup

I am refactoring an existing application and want to learn / move forward with WCF services contained within a Windows Service.  I have several WCF services that will only connect through Named Pipes - the client applications will receive information through callbacks - what is the proper way to keep the channel open - events may not occur for hours.  Is there a way to keep the session connection open until the clients have disconnected?

.NET 3.5 Adds Named Pipes Support

you want a named pipe server, all you have to do is create some instances of NamedPipeServerStream to handle each client connection. I stole the following code straight from the MSDN documentation.

Named Pipes code

We created a very simplistic wrapper for named pipes. If all you need is a basic messag epipe, this should work for you. Code & info at Named Pipes in .NET thanks - daveVery funny video - Reporting as a Metaphor

Named Pipes provider error - backup script

I have a couple of installs of SQL Server 2005 Express.  One thing it doesn't provide is an agent to schedule jobs so I read where you can use Windows job scheduler to execute a batch job to in turn run a sqlcmd file.  I have that working on one server but on the other server I get the dreaded Name Pipes provider error and it goes on to talk about it may not be setup to allow remote connections.  If I check using Surface Configurator it is set to allow remote connections using both tcpip and named pipes.  To my knowledge all I want it tcpip but I enabled named pipes in an effort to get things working. About the only difference I can see is on the working system the database is a named instance (ie. Servername) versus default instance on the non-working system which shows up as (Servername\SQLEXPRESS).  Hopefully I have my terminology right here. Any tips on how to troubleshoot?  Does it depend on the username I am using?  Domain admin or local server admin or what have you? I should mention I can execute the backup script and it does work.  It is when I run the batch job that it fails. The batch job just says "sqlcmd -i d:\MSSQL_Jobs\backup.sql -o d:\Logs\sqlbackup_output.txt"

Best Practices for WPF Single Instance with named pipes?

Hi, I've developed a WPF server-hub-typed application, and a bunch of client-typed applications. The hub app is always a single instance (using mutex), and implements named pipes.   However, I'm having problem with the clients. The clients are applications that send data to the hub. They need to start the hub if it is not already running.   The problem with these clients is, they are optional and portable. Hence, the user might store them in different locations on their system. I really do not wish to deploy the Hub application with every client. What's the best way for me to implement this?   Another thing, do I *have* to use Process.Start(path, args) to start my hub application?    I've attached a sample project that I've done. But there are several problems with it, which I've not figured out how to fix. http://www.sendspace.com/file/ykhdg0   Thanks Min Chew   [References I've used:] http://blogs.microsoft.co.il/blogs/maxim/archive/2010/02/13/single-instance-application-manager.aspx <-- This is the one that seems the most promising (single instance + IPC), but I want a bare-minimum example so I can get a better hang on things. Besides, it crashes when I click on any of the 3 Run buttons http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication <-- Named pipe IPC using wcf http://www.switchonthec

how to choose between Shared Memory, Named Pipes, TCP/IP, VIA?

What protocol to choose? Or, Why are they so many? I am mostly interested in contexts: 1)  development on local machine 2) development from remote machine (having SQL Server on another machine)  3) Production 4) what else should I bother/know about? I am developer, mostly using Developer Ed. mostly locally on Windows XP Pro SP3, and really had never bothered which protocol was used as far as connection was being successful. And I had never had any troubles to bother looking and choosing between protocols Why and when should I bother to choose between protocols for development?

Named Pipes Provider, error: 40 - Could not open a connection to SQL Server


This was originally posted in the SSIS Forum, but a member of the IS team suggested it be moved here.  "Most recently I got this error (Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) so does this mean that SQL Server is still trying to use named pipes even if I only have TCP/IP enabled in SQL Server Configuration Manager?"

I'm having the same issue, and here's our scenario:

  1. Installed SQL Server 2005 Developer Edition on a machine with WinXP SP2 and enabled remote connections over TCP/IP
  2. Installed SQL Server 2005 Standard Edition on a machine with Win2003 SP1 (remote connections over TCP/IP enabled by default)
  3. Attempted to 'Copy Database' from Developer Edition TO Standard Edition using 'Detach and Attach' method and recieved the error on the Win2003 machine: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
  4. A

How to use Named Pipes for Inter Process Communication and transfer of lots of data?


I guess I have posted my question at the wrong place before:

So hopefully somebody in this forum can advise me on how to make my code work properly. Here's what I did:

I created a Windows service that opens a named pipe to receive data from an external application. Latter one connects and transfers up to 250 MB of data via a named pipe after it serialized a LIST of objects.

My windows service deserializes the data back into a LIST of objects, processes them and outputs the entire list into a file.

My issues are:

1.The data transfer is extremely slow! 200 MB take about 7 minutes via named pipe vs. 20 seconds if a file is used.
QUESTION: is it possible to speed up the data transfer somehow?

2.After my Windows service based processing is done I dispose the named pipe, clear the list and even call GC.Collect() but still my service is not releasing the memory.

3.Also I continue to have very high CPU load (98%) on all cores (2xQuad-core) although the service is not doing anything.
 It would be great if somebody could advise me on some of the p

provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

after lots  of goes and back, I have the same problem but it is related to my Visual studio too. Because I can access to the same database  for new projects but when I use an existing project with a new default page I get the same error.
I am using visual studio 2005 connecting to MSSQL 2008 in server that has an instance of SQLServer express 2005 too
the code for boht new and existing project is bellow

I appricate any help


protected void Page_Load(object sender, EventArgs e)



SqlConnection cn =

[.Net 4, Named Pipes, Single-instance app] Critique the code, please


The code below is a prototype of single-instance component. Of course there's a lot of work to get it done: separate into an component, add different names per user session, run server in background thread and so on and so on.

Currently, I'm interested in finding wrong options supplied, invalid usages, security holes or anything I missed. E.g. I'm almost sure there's a bug: the code allows for remote connections. I'll prove it on monday, as I've no access to local network for now.

using System;
using System.IO;
using System.IO.Pipes;
using System.Security.AccessControl;
using System.Security.Principal;

namespace ProcessSingleInstance
 class Program
  static void Main(string[] args)
   string[] data = new[] { "a", "aaaaa", "qweqeqweqeqweqwert" };


provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server


On windows 2008 using sql 2k8 standard edition. I have a couple of apps that run on the server. One works perfectly and attaches to sql with no problem. The second app that uses THE EXACT SAME CONNECTION STRING and gives me the following error,

provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

How can one app work and the other not? What can I check for?


Named Pipes Provider: Could not open a connection to SQL Server [2]


I'm a complete sql/asp.net newbie and want to try this tutorial:

First I installed:
Visual Web Developer 2005 Express Edition Beta 2

systemsettings\software shows the "sql server 2005 express edition ctp (sqlexpress)" installed

mmc\service shows me the SQL Server (SQLExpress) is running

Following the guided tour I use the commandline, type cmd, and type in the commandbox:
"C:\Program Files\Microsoft SQL Server\90\Tools\binn\SQLCMD90" -S "localhost\SqlExpress"

Instead of localhost I also tried computername.smallbusiness.local (thats my fully domain name).

However I always receive the error:

Named Pipes Provider: Could not open a connection to SQL Server [2]

Thank you very much for all your help

named pipes provide: could not open a connection to SQL server [2]

I am trying to connect to an SQL Database on SQL 2008, through an ODBC link but keep getting the above error. I do not know how to fix it. I am trying to make the connection on the server?  dont know whether that makes any difference

A better way to reference your wizard steps using named steps

Note: this article uses the plain vanilla but the concepts apply equally well to its popular counterpart .

By far the most common way that I see wizard steps reference in code snippets is by their index.

Some basic MVC question

  1. In regular asp net I can run (debug) the application but I can either "view in browser" that gives me the option to view the application and write code on same time.

In MVC I can't find this option.

  1. What is the basic DATA MODEL for working with SQL DB.

I mean with no any framework (entity framework, Sub sonic, Link to SQL etc')

I look for basic application that works with data but with no fw.

  1. What is the popular DB framework that working with data.
  2.  I am looking on  mvc series


C# Soup To Nuts  (the best series ever)


I watch some of the MVC video, seems that the music store is good but I have to wait to the other part.

Does any one know and recommend   a Microsoft MVC tutorial?





Web Site to Web Application Question


I've been building web sites and for my next project I will be creating a web application.  I use a 'BasePage' class in all my projects but, since web applications do not contain the 'App_Code' folder, what is the best place/practice for the 'BasePage' class?



connection string question from a newbie


when publishing  in the webmatrix dialogue it asks for "destination connection string" for my "database.mdf"

I was not sure what it was so I pasted this from my web.config file :

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database.mdf;Integrated Security=True;User Instance=True

it all published ok, but wont run, so I guess it has somthing to do with this connection string or some kind of configuration issue.

My question is this, What should go in the field for "Destination connection string"

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