ConnectionMultiplexer.Connect breaks while connecting to redis server - redis

I successfully installed the Redis server on my Windows 7 machine.
Did a quick hands on, everything works as expected.
(installed using the MSI installer from https://github.com/MSOpenTech/redis )
I am using the StackExchange redis client C# for connecting to Redis server.
RedisClient
P.S. : I did not build the application on my machine as I am having VS 2010 and that was throwing some error. So i installed the nuget package and now my Test App in C# has the assembly StackExchange.Redis
My console app is simple with just one line of code
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost:6379,allowAdmin=true");
It gives me an error :
System.AggregateException was unhandled
HResult=-2146233088
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout)
at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Func`1 multiplexerFactory, TextWriter log) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 817
at StackExchange.Redis.ConnectionMultiplexer.Connect(String configuration, TextWriter log) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 795
at testapp.Program.Main(String[] args) in D:\_Work\TestApp\Program.cs:line 64
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Security.VerificationException
HResult=-2146233075
Message=Method System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[System.Boolean].AwaitUnsafeOnCompleted: type argument 'Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[StackExchange.Redis.ServerEndPoint]' violates the constraint of type parameter 'TAwaiter'.
Source=StackExchange.Redis
StackTrace:
at StackExchange.Redis.ConnectionMultiplexer.<ReconfigureAsync>d__2d.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at StackExchange.Redis.ConnectionMultiplexer.ReconfigureAsync(Boolean first, Boolean reconfigureAll, TextWriter log, EndPoint blame, String cause, Boolean publishReconfigure, CommandFlags publishReconfigureFlags)
at StackExchange.Redis.ConnectionMultiplexer.<>c__DisplayClass29.<ConnectImpl>b__26() in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 815
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
InnerException:

For anyone else who stumbles on this the cause is a version mismatch with the Microsoft.Bcl package. Run the command Update-Package Microsoft.Bcl to resolve.
see http://blog.marcgravell.com/2014/03/so-i-went-and-wrote-another-redis-client.html?showComment=1405397410965#c8649668071319126908

Related

WCF service Unable to establish trust relationship for the SSL/TLS secure channel with authority

I have a WCF service that I want to use to connect to an external provider's API. The Client constructor in my service looks like this:
public partial class SomePortTypeClient : System.ServiceModel.ClientBase<SomeService.ClientPortType>, SomeService.SomePortType
{
static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
public SomePortTypeClient(string endpointUrl, TimeSpan timeout, string username, string password) :
base(SomePortTypeClient.GetBindingForEndpoint(timeout), SomePortTypeClient.GetEndpointAddress(endpointUrl))
{
this.ChannelFactory.Credentials.UserName.UserName = username;
this.ChannelFactory.Credentials.UserName.Password = password;
this.ChannelFactory.Credentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine,
System.Security.Cryptography.X509Certificates.StoreName.Root, System.Security.Cryptography.X509Certificates.X509FindType.FindByThumbprint, "11au2i3h3ir3o1748905");
}
The client includes a https binding like this:
private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(TimeSpan timeout)
{
var httpsBinding = new BasicHttpsBinding();
httpsBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
httpsBinding.Security.Mode = BasicHttpsSecurityMode.Transport;
var integerMaxValue = int.MaxValue;
httpsBinding.MaxBufferSize = integerMaxValue;
httpsBinding.MaxReceivedMessageSize = integerMaxValue;
httpsBinding.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
httpsBinding.AllowCookies = true;
httpsBinding.ReceiveTimeout = timeout;
httpsBinding.SendTimeout = timeout;
httpsBinding.OpenTimeout = timeout;
httpsBinding.CloseTimeout = timeout;
return httpsBinding;
}
And then the actual implementation of the client and calling the endpoint:
TimeSpan duration = new TimeSpan(0, 1, 0);
SomePortTypeClient someClient = new SomePortTypeClient("https://endpointURL", duration, "username", "password");
var response = someClient.someMethod(someParameter).Result;
I created a CSR in Windows cert manager, and the external provider provided the certificates shown in the picture below which I have imported both into my personal and root store on my local machine. It is the top certificate that I use "SetCertificate" on and locate by thumbprint in my client constructor. This certifiate is linked to the Intermediate CA which is again linked to the Root CA.
So! When I run the code and try to call the endpoint I get the following error:
I'm a bit of a noob when it comes to certificates and WCF services, so I'm not sure what could be wrong here. I have tried using the three different certificates, both from the personal and the root store. I have also tried using just basic authentication and none while also setting the username, password and certificate. The service I'm trying to call is a SOAP service.
UPDATE: It seems the certificate was not signed with the correct private key. I reimported the certificate and the error disappeard, however now I'm getting a new error that just says A security error was encountered when verifying the message. I've looked around and it seems this is often caused by a time difference between the client/server. I'm not sure how to solve this either, so any help is appreciated.
UPDATE: I enabled WCF tracing, here is the stack trace for the exception:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131075</EventID><Type>3</Type><SubType Name="Error">0</SubType><Level>2</Level><TimeCreated SystemTime="2019-11-25T07:12:21.8768782Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="ConsoleApp1" ProcessID="22044" ThreadID="6" /><Channel /><Computer>LAPTOP-U7FDFSNI</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"><TraceIdentifier>https://learn.microsoft.com/dotnet/framework/wcf/diagnostics/tracing/System-ServiceModel-Diagnostics-ThrowingException</TraceIdentifier><Description>Throwing an exception.</Description><AppDomain>ConsoleApp1.exe</AppDomain><Exception><ExceptionType>System.ServiceModel.Security.SecurityNegotiationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Could not establish secure channel for SSL/TLS with authority 'URI'.</Message><StackTrace> at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.OnGetResponse(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CompleteCallback(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.HttpWebRequest.SetResponse(Exception E)
at System.Net.HttpWebRequest.CheckWriteSideResponseProcessing()
at System.Net.ConnectStream.ProcessWriteCallDone(ConnectionReturnResult returnResult)
at System.Net.HttpWebRequest.WriteCallDone(ConnectStream stream, ConnectionReturnResult returnResult)
at System.Net.ConnectStream.CallDone(ConnectionReturnResult returnResult)
at System.Net.ConnectStream.IOError(Exception exception, Boolean willThrow)
at System.Net.ConnectStream.HandleWriteHeadersException(Exception e, WebExceptionStatus error)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.TlsStream.ResumeIOWorker(Object result)
at System.Net.TlsStream.WakeupPendingIO(IAsyncResult ar)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Security.SslState.FinishHandshake(Exception e, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CompleteCallback(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace><ExceptionString>System.ServiceModel.Security.SecurityNegotiationException: Could not establish secure channel for SSL/TLS with authority 'URI'. ---&gt; System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---</ExceptionString><InnerException><ExceptionType>System.Net.WebException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The request was aborted: Could not create SSL/TLS secure channel.</Message><StackTrace> at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)</StackTrace><ExceptionString>System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)</ExceptionString></InnerException></Exception></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent>

How do I download the all_user.csv report from GitHub Enterprise with vb.net and avoid a 404 error? I can can do this using Curl

I am attempting to download GitHub Enterprise's all_users.csv file via vb.net using .net framework 4.5.2 and get the following error:
The remote server returned an error: (404) Not Found.
My code is:
Module Module1
Sub Main()
Dim remoteUri As String = "https://ghe.webserver/stafftools/reports/all_users.csv"
Dim fileName As String = "all_users.csv"
Dim password As String = "PERSONALACCESSTOKEN"
Dim username As String = "USERNAME"
System.Net.ServicePointManager.Expect100Continue = True
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
Dim client As New System.Net.WebClient
client.Credentials = New System.Net.NetworkCredential(username, password)
client.DownloadFile(remoteUri, fileName)
End Sub
End Module
The error occurs at the line client.DownloadFile(remoteUri, fileName) with the full exception
System.Net.WebException was unhandled
HResult=-2146233079
Message=The remote server returned an error: (404) Not Found.
Source=System
StackTrace:
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at ConsoleApplication1.Module1.Main() in C:\Users\Admin\AppData\Local\Temporary Projects\ConsoleApplication1\Module1.vb:line 13
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
The following Curl command however works (as described here:https://help.github.com/en/enterprise/2.17/admin/installation/site-admin-dashboard#reports):
curl -L -u USERNAME:PERSONALACCESSTOKEN --insecure https://ghe.webserver/stafftools/reports/all_users.csv

VB Error : Could not load file or assembly or one of it's dependencies

I have project VB.Net. Project had successfully started
on Visual Studio 2010. But when it started on Visual Studio 2017, it appeared errors as below.
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes() in f:\dd\ndp\clr\src\BCL\system\reflection\assembly.cs:line 1515
at System.Reflection.Assembly.get_ExportedTypes() in f:\dd\ndp\clr\src\BCL\system\reflection\assembly.cs:line 767
at Microsoft.VisualStudio.DesignTools.WpfTap.WpfVisualTreeService.VisualTreeService.GetEnumTypes()
at Microsoft.VisualStudio.DesignTools.WpfTap.WpfVisualTreeService.VisualTreeService.HandleEnumsRequest(EmptyRequestInfo request)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.HandleMessage[TMessage,TReply](Func`2 callback, Message request)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.c__DisplayClass25_0`2.b__0(Message message)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.OnMessageReceived(Byte[] buffer)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.ReadThread()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state) in f:\dd\ndp\clr\src\BCL\system\threading\thread.cs:line 68
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 954
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 901
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 890
at System.Threading.ThreadHelper.ThreadStart() in f:\dd\ndp\clr\src\BCL\system\threading\thread.cs:line 105
Please help me to solve this. Thank You!

Deploying a WCF service to IIS 7 64bit

I'm working on a WCF service and and Im testing it out in Cassini. I also have a console app and has a web ref. to the svc hosted in cassini. This works fine and I'm able to invoke to service method. But when I deploy the svc to IIS and I try to run to console app I'm getting this error.
System.ServiceModel.FaultException`1 was unhandled
Message=There was an error in deserializing one of the headers in message NotifRQRequest. Please see InnerException for more details.
Source=mscorlib
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
reply, MessageFault fault, String action, MessageVersion version,
FaultConverter faultConverter)
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 rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at TestConsole.ServiceReference1.IPush.RQ(NotifRQRequest request)
at TestConsole.ServiceReference1.PushClient.TestConsole.ServiceReference1.IPush.NotifRQ(NotifRQRequest
request) in ServiceReference1\Reference.cs:line 37165
at TestConsole.ServiceReference1.Client.RQ(Security Security, Action Action, MessageID MessageID, ReplyTo ReplyTo, To To,
NotifRQ notifRQ1) ServiceReference1\Reference.cs:line 37176
at TestConsole.Program.Main(String[] args)
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
I'm running a x64 envt. and even tried changing to different app pools.
Any suggestions or hinds would be greatly appreciated.
Thanks,
EDIT 1:
Just noticed one thing. The svc uses about 5 xml namespaces that are listed in the wsdl. In cassini, I can browse then i.e. I can hit localhost/Notification/NotificationService.svc?xsd=xsd0 but I cant do the same on IIS!!!
<xsd:schema targetNamespace="http://www.opentravel.org/OTA/2003/05/Imports">
<xsd:import schemaLocation="http://localhost/Notification/NotificationService.svc?xsd=xsd0" namespace="http://www.opentravel.org/OTA/2003/05"/>
<xsd:import schemaLocation="http://localhost/Notification/NotificationService.svc?xsd=xsd1" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
<xsd:import schemaLocation="http://localhost/Notification/NotificationService.svc?xsd=xsd3" namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing"/>
<xsd:import schemaLocation="http://localhost/Notification/NotificationService.svc?xsd=xsd2" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"/>
<xsd:import schemaLocation="http://p/Notification/NotificationService.svc?xsd=xsd4" namespace="http://htng.org/2011A"/>
</xsd:schema>
EDIT 2:
It appears that this seems to be happening only on a 64 bit machine and works fine on a 32bit.
Turned out to be an issue with the Redirect module configuration specified in web.config

There was an error writing to the pipe: Unrecognized error 232 (0xe8)

I call a method in a WCF proxy, where the binding is named pipes. At the moment, the code fails with an exception (related to wmi - what the code does), but when I then execute another method in the same proxy, I get this error:
There was an error writing to the pipe: Unrecognized error 232 (0xe8).
Obviously, this doesn't help much. Stacktrace is:
Server stack trace: at
System.ServiceModel.Channels.StreamConnection.BeginWrite(Byte[]
buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout,
AsyncCallback callback, Object state) at
System.ServiceModel.Channels.FramingDuplexSessionChannel.SendAsyncResult.WriteCore()
at
System.ServiceModel.Channels.FramingDuplexSessionChannel.SendAsyncResult..ctor(FramingDuplexSessionChannel
channel, Message message, TimeSpan timeout, AsyncCallback callback,
Object state) at
System.ServiceModel.Channels.FramingDuplexSessionChannel.OnBeginSend(Message
message, TimeSpan timeout, AsyncCallback callback, Object state) at
System.ServiceModel.Channels.OutputChannel.BeginSend(Message message,
TimeSpan timeout, AsyncCallback callback, Object state) at
System.ServiceModel.Dispatcher.DuplexChannelBinder.BeginRequest(Message
message, TimeSpan timeout, AsyncCallback callback, Object state) at
System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartSend(Boolean
completedSynchronously) at
System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.FinishEnsureOpen(IAsyncResult
result, Boolean completedSynchronously) at
System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartEnsureOpen(Boolean
completedSynchronously) at
System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.FinishEnsureInteractiveInit(IAsyncResult
result, Boolean completedSynchronously) at
System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartEnsureInteractiveInit()
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.Begin()
at System.ServiceModel.Channels.ServiceChannel.BeginCall(String
action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
TimeSpan timeout, AsyncCallback callback, Object asyncState) at
System.ServiceModel.Channels.ServiceChannel.BeginCall(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
AsyncCallback callback, Object asyncState) at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeBeginService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation) at
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) at x.xxx.xxxxx(String Path, AsyncCallback
callback, Object state) at x.xproxy.begininstall(String path,
AsyncCallback callback, Object state) in
C:\Users\project\AsyncProxy.cs:line 38 at
xxx.MainForm.begininstall(Object sender, EventArgs e) in
C:\Users\project\MainForm.cs:line 647 at
XPrintV7.MainForm.b__e() in
C:\Users\Gurdip\Desktop\xproject\MainForm.cs:line 664 at
System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry
tme) at
System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Object userData) at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData) at
System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state) at
System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state) at
System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry
tme) at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
What is the probable cause?
The error message tells you that the Win32 error ERROR_NO_DATA occurred when the client-side channel stack tried to send a message to the service over the named pipe. It's difficult to diagnose beyond that with just the info you have provided, but it probably indicates that the client and server ends of the named pipe have got into inconsistent states as a result of the preceding WMI error. Possibly your client-side code is not managing the state of the service proxy instance correctly when the WMI exception happens.
You should enable verbose WCF tracing on both client and service sides, which will provide a clearer picture of what is going on.
Also, posting some of your client code to show where the WMI exception occurs, and how the service proxy is dealt with in the exception handling, may enable someone to answer your question more precisely.