Xamarin Android Visual Studio layout not rendering when creating new blank app - c#

I try to create new project using xamarin android blank app. When I try to open the main.axml layout, it give below error:
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at Xamarin.AndroidDesigner.Java.JavaCommunicationContext.ReadMessageLoop() in C:\d\lanes\4699\1be4f0c9\source\xamarinvs\External\md-addins\MonoDevelop.MonoDroid\Xamarin.AndroidDesigner\Xamarin.AndroidDesigner.Java\JavaCommunicationContext.cs:line 227

Same problem for me when I open the layout. It supposed to be a version problem of xamarin (check this post :
Unable to render xamarin android layout
I ckeck that version, it's the 4.5.0.476, the same as the post above.
I'll try to downgrade this version, I'll keep you informed

Related

Web client throwing exception "Unable to read data from the transport connection:"

Background:
We have a common service to download a file to specific location. This service uses WebClient to download a file. This service is used by multiple applications.
.Net Framenwork: 4.5.2
Enabled TLS version on Prod, UAT: TLs1.3, TLS1.2
Issue:
Sometimes We are receiving an exception mentioned below on Prod server only not QA, UAT.
An exception occurred during a WebClient request.
InnerException :
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
--- End of inner exception stack trace ---
at System.Net.ConnectStream.EndRead(IAsyncResult asyncResult)
at System.Net.WebClient.DownloadBitsReadCallbackState(DownloadBitsState state, IAsyncResult result)
Query: When looked for this type of issue almost every page on internet is saying it TLS issue, just add a line mention below in code. And few pages are saying don't hardcode the TLS version.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
I also believe we should not hardcode the tls version.
But I am not getting what is the actual root cause of this issue?
why this issue is intermittent and why this persist on only Prod?
Code:
WebClient wc = new WebClient();
await wc.DownloadFileTaskAsync(new Uri(webendpoint), sharedPath);
return 0;

TCP WCF Client as windows service connects only under administrator user privilege

I have been writing windows services for over a decade but this is my first with WCF TCP.
Problem:
In a client-server WCF TCP scenario (separate computers), server part works perfect. The client code also works perfect as console app, but when running the same code inside a windows service, it works only under Administrator user. Using Network Service or Local Service (as required for such usages) ends with the following error:
The socket connection was aborted. This could be caused by an error
processing your message or a receive timeout being exceeded by the remote
host, or an underlying network resource issue. Local socket timeout was
'00:00:59.8938785'.
An existing connection was forcibly closed by the remote host System
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size,
SocketFlags socketFlags)
at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32
offset, Int32 size, Boolean immediate, TimeSpan timeout)
System
at System.Net.Security.NegotiateStream.ProcessWrite(Byte[] buffer, Int32
offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.Write(Byte[] buffer, Int32 offset,
Int32 count)
at System.ServiceModel.Channels.StreamConnection.Write(Byte[] buffer, Int32
offset, Int32 size, Boolean immediate, TimeSpan timeout)
To simplify the situation, I wrote a WCF server as windows service which utilizes a simple [OperationContract] method which gets a string and echoes it back, so code is not a big deal. Also, this has nothing with timeout settings on server or client, but client user accounts.
Client part (console app and win service, under different users) tested on Windows 10 Pro and Windows Server 2003 with the same results. Server part resides on a Windows Server 2003. All in .Net 4.
Question:
A windows service under Administrator user is not an option, so how can I force WCF TCP client on windows service working under Local Service / Network Service?
Update
WCF tracing report in rar format
Update 2
Sample Project
Regards

C# WatiN Firefox - Unable to read data from the transport connection

I'm trying to launch a web bot developed with WatiN (via Firefox).
It launches and works perfectly on my computer (even without launching it as admin), however when I launch it from my VPS (where I'm not admin), Firefox and my application immediatly crash.
The console shows (I translated it from french) :
Unhandled exception: System.IO.IOException: Unable to read data from the transport connection: an existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: an existing connection was forcibly closed by the remote host.
to System.Net.Sockets.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
to System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
to System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
to WatiN.Core.Native.Mozilla.FireFoxClientPort.ReadResponse(Boolean resultExpected, Boolean checkForErrors)
to WatiN.Core.Native.Mozilla.FireFoxClientPort.WaitForConnectionEstablished()
to WatiN.Core.Native.Mozilla.FireFoxClientPort.Connect(String url, Boolean createNewFirefoxInstance)
to WatiN.Core.Native.Mozilla.FireFoxClientPort.Connect(String url)
to WatiN.Core.Native.Mozilla.CreateFireFoxInstance(String url)
to MyTranslationAutomation.MyTranslation..ctor(MyConsole& console)
to Program.Actions.Main()
Console:
Finally it worked when I install a new version of the FireFox's JSSH plugin, found with SWAT: http://sourceforge.net/projects/ulti-swat/files/

ASP.NET WebMethod and half-open connections

Consider the situation where some client calls WebMethod and after connection was established the host process crashes and connection becomes half-open. Will ASP.NET WebMethod proxy automatically detect it?
We assume that WebMethod timeout settled to the infinity or some big amount of time. Will connectivity error be detected only on TCP keep-alive packet sending (after 2 hours of idle on Windows by default)?
[WebService(Namespace = "http://www.example.com/TestService/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class TestService : System.Web.Services.WebService
{
[WebMethod]
public void DoLongWork()
{
// long work here
}
}
Web Reference proxy call:
public void ServiceClient()
{
var serviceProxy = new MyNamespace.TestService();
// serviceProxy.Url = ...
serviceProxy.Timeout = -1; // do not use timeout
// will it wait for 2 hours (when TCP keep-alive will be sent) if connection was lost after handshake?
serviceProxy.DoLongWork();
}
UPDATE.
I've tried multiple scenarios and here the results that I got using Wireshark to see what is going on under the hood.
Stopping hosting Web Server (IIS) through the IIS Manager or killing host process (w3wp.exe):
In both cases client notified via sending TCP RST flag. Seems Windows takes care of closing sockets for crashed/killed processes. In .NET the System.Net.WebException will be thrown:
Unhandled Exception: System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at WebMethodAndTCPHalfOpenTest.TestWebReference.TestService.DoLongWork(Int32 sec)
at WebMethodAndTCPHalfOpenTest.Program.Main(String[] args)
Killed the host process after connectivity (to the host) loss, so TCP RST can not reach client:
Results here is very tangling for me, because after 2.5 hours the broken connection (half-open) is not detected and client still thinks that underlying TCP connection is alive (the same situation after 6 hours). Here the output from Sysinternals TCPView:
TCPView v3.01 - TCP/UDP endpoint viewer Copyright (C) 1998-2010
Mark Russinovich and Bryce Cogswell Sysinternals -
www.sysinternals.com
[TCP] WebMethodAndTCPHalfOpenTest.exe
PID: 8180
State: ESTABLISHED
Local: 192.168.1.2
Remote: 5.167.159.81
Windows Version: Microsoft Windows [Version 6.1.7601]
Wireshark output:
I've checked KeepAliveTime registry setting on my system here: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters and it was missing, so the default 2 hours should be used (?).
Can anybody explain the result described in the second point? Why TCP keepalive was not sent? Is proxy explicitly settled up different keepalive behavior for underlying socket (https://msdn.microsoft.com/en-us/library/windows/desktop/ee470551(v=vs.85).aspx)?
It looks like the keep alive is not garanteed because things might muck with that setting in windows (no the registry value isn't the end all).
According to this:
Windows TCP socket has SO_KEEPALIVE enabled by default?
It looks like you should not rely on this behavior and set a timeout. If you are using a soap request, you could always invoke an async request, and then wait on the request based on a client configurable value, and have a nice logic handling for timeouts.
If the host process crashes the connection will close. It won't wait for the TCP keep-alive to kick. You can easily test this scenario by spinning your WebService and making it crash voluntary.

Deploying report shows an error

I'm using SSRS 2008 R2 for my reports.
I have been working in my local environment and there was no problem with deploying to the local server. Now I want to deploy all the reports to live server but when I try to deploy to the live server by changing the Target server url and then providing the user name and password. its showing the error. (I'm deploying from VS 2008)
===================================
Could not connect to the report server http://192.168.0.217/ReportServer. Verify that the TargetServerURL is valid and that you have the correct permissions to connect to the report server. (Microsoft SQL Server Report Designer)
===================================
The underlying connection was closed: An unexpected error occurred on a receive. (System.Web.Services)
------------------------------
Program Location:
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.SqlServer.ReportingServices2006.ReportServiceAuthentication.GetAuthenticationMode()
at ReportServiceClient2010.CheckAuthenticated()
at Microsoft.ReportDesigner.Project.ReportClientManager.DetectEndpointAndAuthenticate(String url, ICredentials credentials, String& authCookieName, Cookie& authCookie, EndpointType& endpointType)
at Microsoft.ReportDesigner.Project.ReportClientManager.DetectEndpointAndAuthenticate(String url, ConnectionProperties& connectionProperties)
at Microsoft.ReportDesigner.Project.ReportClientManager.GetCredentials(String url, CancelFlag cancelFlag)
at Microsoft.ReportDesigner.Project.ReportProjectDeployer.PrepareDeploy()
===================================
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. (System)
------------------------------
Program Location:
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
===================================
An existing connection was forcibly closed by the remote host (System)
------------------------------
Program Location:
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
But Im able to browse the report server from my local machine by providing the credentials. Anyone knowsa solution for this?
Try this , should help mostly. Also try and see if you are able to upload reports one by one using the Upload facility on the SSRS server itself
http://www.sqlservercentral.com/Forums/Topic1135602-150-1.aspx#bm1135709

Categories