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


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

NamedPipeClientStream.EndRead throws OperationCanceledException

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :.NET Framework
 
Hello.
I'm using named pipes for interproccess communications. But sometimes I've got failures first time reading from pipe.
I've checked MSDN but couldnt'f find any answer on the problem.
Code I'm using to connect and read:

//---Connecting
NamedPipeClientStream stream = new NamedPipeClientStream(
			pipeHost,
			pipeName,
			PipeDirection.InOut,
PipeOptions.Asynchronous, TokenImpersonationLevel.None ); try { stream.Connect(connectTimeout); } //...catch() and other stuff... args.pipe = stream; stream.BeginRead( args.buffer, 0, args.buffer.Length, PipeAsyncReadCallbackProc, args);
//________________________________________________________________________
//---Reading void PipeAsyncReadCallbackProc(IAsyncResult asyncResult) { ThreadPipeArgs args = (ThreadPipeArgs)asyncResult.AsyncState; int result = 0; try { result = args.pipe.EndRead(asyncResult); } catch (OperationCanceledException ex) { // -----> Here I've got an Exception }
Server-side code (MFC):

hPipe = CreateNamedPipe( 
          lpszPipename,             // pipe name 
          PIPE_ACCESS_DUPLEX,       // read/write access 
          PIPE_TYPE_MESSAGE |       // message type pipe 
          PIPE_READMODE_MESSAGE |   // message-read mode 
          PIPE_WAIT,             


View Complete Post


More Related Resource Links

userprincipal.changepassword throws exception

  

Hi all,

      userprincipal.changepassword(oldpassword, newpassword);

gives error: that is Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied. (Exception from HRESULT: 0x80070547)

but userDirectoryEntry.invoke("ChangePassword", new object[] { oldpassword, newpassword });

      userDirectoryEntry.CommitChanges works fine.

Any one please tell me the reason behind this.




WebControls.TableRow throws exception on Add()

  

I have the following method to strip hidden and user-specified columns from a gridviewrow and return a tablerow. 

    Private Shared Function StripHiddenColumns(ByVal gvRow As GridViewRow, ByVal ColumnsToExclude() As Integer) As TableRow

        Dim row As New TableRow
        Dim i As Integer = 0
        Try
            For Each cell As TableCell In gvRow.Cells
                If cell.Visible Then
                    If Not ColumnsToExclude.Contains(i) Then
                        row.Cells.Add(cell)
                    End If
                End If
                i += 1
            Next

            Return row
        Catch ex As Exception
            Throw ex
        End Try
    End Function

However, when I run this code and hit the Add method for the TableRow,  I get an InvalidOperationException stating the Collection was modified; enumeration operation may not execute.  I've gotten this exception before, but usually it's because I'm attempting to modify a table that is databound.  This particular one is not, i am creating it.  Can anyone offer any insight? 

Thanks in advance.

thefunnyman


ScriptResource.axd throws ArgumentOutOfRangeException

  

I've done a lot of research on this error and I can't seem to figure it out:

 

Specified argument was out of the range of valid values.
Parameter name: utcDate

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: utcDate

Source Error: 

Security trimmed URL throws an error if not logged in

  
On a Moss 2007 site, using FBA - I have an issue with security trimmed items within Lists.   There is not a problem with direct url links to non-list items.  
For list items - here is the problem, when a user is not logged in and follows a direct url link from an email or newsletter to security trimmed items within a list - it throws an error instead of offering a redirect to login?

More info:  This is only occurring for individually security trimmed list items that have had anonymous access removed.  When a whole list or library has had anonymous removed, the links work fine (login page appears, log in, taken to original link).



Why is that and is there a way to avoid the error?


If it is of help, this is the error. Thanks in advance.

------------------------
Object reference not set to an instance of an object.


Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not
set to an insta

SPWorkflowManager.CancelWorkflow throws an exception

  

Sorry, I had posted that same question in the "Dev and Programming" forum, but I'm reposting here because it's more of a workflow related question.

We are trying to cancel workflow programmatically.

It used to work fine until we migrated our environment to a new server and now it fails.

Our code goes something like this: 

 

foreach (SPWorkflow wf in form.Workflows)

{

//code omitted for brievety

  SPWorkflowManager.CancelWorkflow(wf);

}

But an ArgumentException is thrown.

Msdn docs say that an ArgumentNullException exception can be thrown (ArgumentNullException: The workflow to cancel belongs to an SPWeb object that has been deleted) but it is actually an ArgumentException that is thrown. Plus I know for sure that the SPWeb does not get deleted.

I tried to reflector what piec

Remoting from WebService throws: An existing connection was forcibly closed by the remote host

  
Hello everyone, I have a problem with using .NET remoting from webservice. When using remoting from console application, there is no problem. I suppose problem is somewhere in IIS. My system is Windows Vista. Thank you for any help. Best regards, Jozef

ssrs 2008 R2 - report parameter with no default set throws java script error

  
We have recently upgraded from SQL Server 2008 to SQL Server 2008 R2....I am experiencing a problem with my report parameters on my SSRS reports. It seems that my report parameters that I do not have a specified 'default' value throws a java script error when I try and run/render the report under R2.  As soon as I put a 'default' value on the report param, everything is fine.  However, that is not the behavior we need for our reports...the user needs to pick their selection. Can anyone shed some light on this, it seems to be an AJAX problem...I need to be able to have report parameters with a list of values, but no 'default' value on the parameter.

Master-Detail GridView in Single Page example with paging throws error

  
___http://www.java2s.com/Code/ASP/Data-Binding/MasterDetailGridViewinSinglePage.htmI followed example at the link above.When I enablind paging=true (by pagesize=3).and clicking to pages 2|3|4 etc and so;error occuringIndex was out of range. Must be non-negative and less than the size of the collection.at cs line :sourceProducts.SelectParameters[0].DefaultValue = gridMaster.DataKeys[e.Row.DataItemIndex].Value.ToString();got any idea?what should I make to fix this ? is this error  fixable ?thanks much.

Process.MainModule on x64 platform throws Win32Exception: "Only part of a ReadProcessMemory or Write

  
This is a very odd issue and I think it should be a bug of .Net framework. the code is like below: class Program { static void Main(string[] args) { try { Process[] procs = Process.GetProcessesByName("abc"); if(procs == null || procs.Length < 1) return; Process proc = procs[0]; Console.WriteLine("Got it: " + proc.MainModule.ModuleName); } catch (Exception ex) { Console.WriteLine("Failed to get process: {0}", ex); } Console.Read(); } } the "abc.exe" is another program compiled with "For Any CPU", and the testing operating system is Windows 2003 x64 When the code is compiled with "x64" or "For Any CPU", it works very well. but, if I change the compiling configuration to "x86", it will throw out a Win32Exception "Only part of a ReadProcessMemory or WriteProcessMemory request was completed" stack trace:    at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId, Boolean firstModuleOnly)    at System.Diagnostics.NtProcessManager.GetFirstModuleInfo(Int32 processId)    at System.Diagnostics.Process.get_MainModule()    at KillProcessTest.Program.Main(String[] args) in D:\Users\rsp\KillProcessTest\KillProcessTest\Program.cs:line 18

SSRS 2008 R2 - OnPostBack from ReportParameter - if no default set, throws Value can not be null

  
SSRS 2008 R2 - OnPostBack from Parameter selection - if no default set, throws Value can not be null java script error. This does not happen with SSRS 2008, only with R2. and only with report parameters that do not have a 'default' set.  Any suggestions would be greatly appreciated.

EvaluateOldNewStates() throws exception when updating TreeViewItem.IsSelected

  
I apply a WPF theme in my application. At some point in my code, I need to change the selected tree view item. so I update the property MyViewModel.IsSelected and raise PropertyChanged event. Then I get this: Object reference not set to an instance of an object. System.Windows.StyleHelper.EvaluateOldNewStates(MultiTrigger multiTrigger, DependencyObject triggerContainer, DependencyProperty changedProperty, DependencyPropertyChangedEventArgs changedArgs, Int32 sourceChildIndex, Style style, FrameworkTemplate frameworkTemplate, Boolean& oldState, Boolean& newState) System.Windows.StyleHelper.InvokePropertyTriggerActions(TriggerBase triggerBase, DependencyObject triggerContainer, DependencyProperty changedProperty, DependencyPropertyChangedEventArgs changedArgs, Int32 sourceChildIndex, Style style, FrameworkTemplate frameworkTemplate) System.Windows.StyleHelper.OnTriggerSourcePropertyInvalidated(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, DependencyPropertyChangedEventArgs changedArgs, Boolean invalidateOnlyContainer, FrugalStructList`1& triggerSourceRecordFromChildIndex, FrugalMap& propertyTriggersWithActions, Int32 sourceChildIndex) System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEve

Page navigation in a frame throws an exception

  
I created a very simple WPF project that exhibits the following error. I have no idea how to get of this error. System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.Menu', AncestorLevel='1''. BindingExpression:Path=TemplatedParent; DataItem=null; target element is 'MenuItem' (Name=''); target property is 'CommandTarget' (type 'IInputElement') Steps to reproduce:1. Create a WPF Application project in Visual Studio 2008 (Windows 7)2. Create Page1.xaml <Page x:Class="WpfApplication1.Page1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Page1"> <TextBlock> <Hyperlink NavigateUri="Page2.xaml">Page 2</Hyperlink> </TextBlock> </Page> 3. Create Page2.xaml <Page x:Class="WpfApplication1.Page2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Page2"> <TextBlock> <Hyperlink NavigateUri="Page1.xaml">Page 1</Hyperlink> </TextBlock> </Page> 4. Add a frame in Window1.xaml <Window x:Class="WpfAppli

SSIS throws error when it doesn't find file

  
Hello All, I am facing one issue that i dont know in advance if there is file on FTP or not. I scheduled a job which runs every hour which in turn calling SSIS package. Now, when there is file on FTP, it works fine. But, when there is no file on FTP then itthrows error which i want to handle. Is it possible to check for any files present on FTP? Cheers, Pranav

Invoking custom WCF service throws an Impersonation error from SQL

  
I've written a custom WCF service and hosted it in SharePoint. Accessing the MEX endpoint works fine. However, when I try to invoke the WCF service from my client code, I get the following error: 'A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - Either a required impersonation level was not provided, or the provided impersonation level is invalid.)'. This exception gets thrown even before my WCF service gets invoked. Attaching a debugger, I see the following stack trace associated with the exception: 00000000`0c2dd7d0 000007fe`e7589b95 System_Data_ni!System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean)+0xd4 00000000`0c2dd810 000007fe`e7b7cd3b System_Data_ni!System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject)+0xf5 00000000`0c2dd870 000007fe`e758c4ee System_Data_ni!System.Data.SqlClient.TdsParserStateObject.WriteSni()+0x5f77ab 00000000`0c2dd8f0 000007fe`e758bf29 System_Data_ni!System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()+0xae 00000000`0c2dd950 000007fe`e757a1c7 System_Data_ni!System.Data.SqlClient.TdsParser.TdsExecuteRPC(System.Data.SqlClient._SqlRPC[], Int32, Boolean, System.Data.Sql.SqlNotificationRequest, System.Data.SqlClient.TdsParserStateObject, Boolean)+0x1189 00000000`0c2ddbf

Consume WCF Data service in client application throws error

  
Hi All, I am working on WCF Data service which imported stored procedure, as below.         [WebGet]         public List<GetMTSearchResultTest_Result> GettMTSearchResultTest()         {             MediaMarketResearch_PRODEntities ent = new MediaMarketResearch_PRODEntities();             return ent.GetMTSearchResultTest().ToList();         }   when i consuming this in my client application it says error as "The closed type MMRClient.MMRServiceReference.GetMTSearchResultTest_Result does not have a corresponding element settable property." I am getting this error while bind to the grid view as below. DataServiceContext context = new DataServiceContext(new Uri("http://localhost:4131/MMRDataService.svc/")); IEnumerable<GetMTSearchResultTest_Result> empResult = context.Execute<GetMTSearchResultTest_Result>(new Uri("http://localhost:4131/MMRDataService.svc/GettMTSearchResultTest"));             GridView1.DataSource = empResult;             GridView1.DataBind(); Note: I im

Consume WCF Data service in client application throws error

  
Hi All, I am working on WCF Data service which imported stored procedure, as below.         [WebGet]         public List<GetMTSearchResultTest_Result> GettMTSearchResultTest()         {             MediaMarketResearch_PRODEntities ent = new MediaMarketResearch_PRODEntities();             return ent.GetMTSearchResultTest().ToList();         }   when i consuming this in my client application it says error as "The closed type MMRClient.MMRServiceReference.GetMTSearchResultTest_Result does not have a corresponding element settable property." I am getting this error while bind to the grid view as below. DataServiceContext context = new DataServiceContext(new Uri("http://localhost:4131/MMRDataService.svc/")); IEnumerable<GetMTSearchResultTest_Result> empResult = context.Execute<GetMTSearchResultTest_Result>(new Uri("http://localhost:4131/MMRDataService.svc/GettMTSearchResultTest"));             GridView1.DataSource = empResult;             GridView1.DataBind(); Note: I im

STSADM -o Backup for SharePoint 2003 SiteCollection throws "The specified URL is not a top-level Web

  
I'm attempting to backup and restore a site collection in a 2003 implementation as part of a process to migrate ~1500 subsites to a MOSS 2007 implementation. My first step was to backup the site collection these subsites were residing in http://CompPortal/sites/MySiteCollection/ When I run the below command in STSADM I get the error "The specified URL is not a top-level Web site. The backup and restore operations work only for top-level Web sites. Enter the URL for a site to try the operation again. stsadm.exe -o backup -url http://CompPortal/sites/MySiteCollection/ -filename "C:\backup\BL" -overwrite I checked in Central Admin to confirm that this is a site collection and I assume a top-level site and site collection are synonymous. Does anybody have a suggestion on what I could be missing? Thanks
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