I have a windows application ( C# app ) and it gets all data from an asp.net web service. It works great on my development PC but not some other computers. When i run the application on an another computer, it opens connections to the web service simultaneously, but some of request not completing.
I watch the web service requests from Fiddler and TCPView.. I think windows blocking simultaneously connections to the same web service address, but I can not catch the real problem is where?
here is the my web service reference override;
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.WebRequest wr = base.GetWebRequest(uri);
System.Net.HttpWebRequest wrHttp = wr as System.Net.HttpWebRequest;
if (wrHttp != null)
{
wrHttp.ServicePoint.Expect100Continue = false;
wrHttp.ServicePoint.ConnectionLimit = 200;
wrHttp.ServicePoint.MaxIdleTime = 200;
wrHttp.ServicePoint.SetTcpKeepAlive(false, 200, 200);
wrHttp.ServicePoint.UseNagleAlgorithm = true;
wrHttp.KeepAlive = false;
wrHttp.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
}
return wr;
}
Related
How do I increase the request timeout so that .Net Core 6 web app (Linux in AWS) can process long running requests? I have an appSettings.json file but that only has custom application settings.
This is my code to configure the web app:
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel(serverOptions =>
{
serverOptions.Limits.MaxRequestBodySize = null; //unlimited
serverOptions.Limits.MaxRequestBufferSize = null;
})
.UseStartup<Startup>();
});
I created a simple HTTP Server in C++ using the Win32 HTTP Server API.
auto server = HttpInitialize(HTTPAPI_VERSION_2, HTTP_INITIALIZE_SERVER | HTTP_INITIALIZE_CONFIG, NULL);
if (!server)
return;
HTTP_SERVER_SESSION_ID session_id = NULL;
auto r = HttpCreateServerSession(HTTPAPI_VERSION_2, &session_id, 0);
The value of r is written to std::cout. The following line appears in the log stream in the Azure Portal:
2022-04-17T13:16:11.590 [Information] HttpCreateServerSession: 5 - Access is denied.
Can this be solved by running the Azure Function with elevated permissions or must I implement a HTTP server using Winsock?
I have got an exception:
The request was aborted: Could not create SSL/TLS secure channel.
While calling java web service using SoapHttpClientProtocol the service enables TLS 1.2.
Client: Windows 10
Host service: Windows Server 2016
Application (client/server): Frameworke 4.6.2
I have added below code before create HttpWebRequest and still get same exception:
System.Net.ServicePointManager.Expect100Continue = true;
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = (snder, cert, chain, error) => true;
I am getting error : -2146697208, while sending xml to payment gateway web service. The application is developed in VB6.0 and the OS is Microsoft windows server 2003.
And also the code works fine in Windows XP, and i verified the same with third party tools for testing Web Services (SOAP UI) in Windows Embedded Standard system and it works fine. Looks like the issue is related to VB6.0 and the OS. Please help.
Code Snippet:
On Error GoTo 0
'Set XMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")
PaymentURL = "https://testpayments.globalone.me/merchant/xmlpayment"
Dim http As Object
Set http = CreateObject("MSXML2.XMLHTTP.6.0")
http.Open "POST", PaymentURL, False
http.setRequestHeader "Content-Type", "text/xml"
http.setRequestHeader "User-Agent", "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405"
http.send (xmldata) (error is thrown here)
Please help me.
Thanks
I'm trying to invoke a webservice using the classes generated by Visual Studio in an ASP MVC project, here is my code:
var serviceClient = new UserSoapClient("UserSoap");
var isValid = serviceClient.CheckEmail(email);
ViewBag.ServiceOutput = isValid? "Email is valid" : "Email is not valid";
return View();
However, the message is timing out and it seems that the problem is that the request header of the SoapClient is not sending the User-Agent property because I tried executing the same service with SOAP UI and that was the only difference. Is there any way of setting the User Agent because I'm looking at the documentation and it doesn't seem to be very obvious.
I have faced with a similar problem while trying to consume a service with SoapClient. I was able to get response from the service via browser but when I execute the code within the project service was returning Protocol Exception with The remote server returned an error: (502) Bad Gateway. message.
After several hours of tracing I have realised that the Exception was caused by the user-agent definition. I have tried to add user-agent to the Soap request header but no way. You can not add user-agent to Soap request registered as Service Reference. But it is possible to define user-agent header to a request registered as Web Service Reference.
What my solution is:
Remove the Service Reference from the project
Add the same reference as Web Reference from the advanced menu of Add Service Reference Window
Create a new object and define UserAgent property like below.
var svc = new ServiceReference.QueryService();
svc.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36";