I have a HaProxy load balancer on front of some IIS webservers. Haproxy checks the iis apps on a specific path if they are up or in maintenance.
I would like to make a solution, where I can safely reboot a random IIS machine and then have this to trigger my iis application to:
React to the reboot and return a certain response code (a 404 in this case) on a specific path
Stall the host machine reboot for 15 seconds to ensure all calls have been dealt with and that haproxy has seen this 404-status code signalling an upcoming reboot of the iis server.
Is it in any way possible to do these two things?
Windows Server 2016, .Net 4.7.2
This will not work, as all calls to the IIS will return "Service unavailable" when the IIS is running the Application_End code:
protected void Application_End()
{
var log = SystemLogManager.GetLogger(GetType());
try
{
log.Warn("Ending application. Hanging for 15 seconds...");
Thread.Sleep(TimeSpan.FromSeconds(15));
log.Warn("Done end");
}
catch(Exception ex)
{
log.Error("Unexpected error in application end", ex);
}
}
You can write a powershell script that you can call on any server and:
Make a webrequest to the check page that set a cache variable "logoffinprogress"
The check page check the cache variable and respond with a 404 http error code
The powershell script wait for 15 seconds and then reboot the server
On server restart iis is working and the checkpage respond with http 200 code
I hope that this can help you
Related
I have a problem in the following code where I used an MSMQ queue:
Message m;
if (t! = TimeSpan.Zero)
{
m = q.Receive (t);
}
plus
{
m =
q.Receive ();
}
What I am doing is consuming a web service that uses this code. The problem is that if I test it locally using the Visual Studio debugger it works. But when I send the message using the service that is deployed in the IIS, when the Receive () method is executed it returns a TimeOut error, apparently due to the lack of permissions.
System.Messaging.MessageQueueException (0x80004005): The timeout for the requested operation has expired
Investigating I think it could be because when using debugger the user who accesses the queue is the one who encounters the session started on the computer. And when the consumption from the service URL the user who accesses is the IIS / DefaultAppPool. But I'm not sure, and I can't make it work, if anyone has any idea of how qualitative the solution would be, I appreciate it in advance.
I am working on Windows Server 2016 with .NetFramework 4.8.
I have a Selenium test which would fail when run as part of a Jenkins job on a node hosted in vSphere and administered through RDP. The test are run with IE11.
After some troubleshooting it turned out it succeeds if Remote Desktop is connected and focused but fails with an exception if Remote Desktop is disconnected or even minimized:
OneTimeSetUp: OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:56095/session/817b36df-a1b5-484e-b205-d4a0bac8002a/element/0cfa6678-2104-4bc6-bb71-e6d8eac507fb/value timed out after 60 seconds.
----> System.Net.WebException : The operation has timed out
The failing line:
textboxElement.SendKeys("foo").Perform();
As a workaround, I logged through vSphere Console instead of RDP and then even after closing vSphere the test didn't fail anymore. This is a workaround but I would have to be careful never to login through RDP and always to administer only through vSphere Console.
So my questions are:
Is SendKeys() somehow incompatible with an RDP session and is it related to this winapi bug?
Is there an alternative to using SendKeys() in Selenium?
When you execute the selenium script without any UI environment bind to the process the size of the Chrome window may be different from when you execute it when you are logged in with RemoteDesktop.
Try to explicitly set window size in the selenium script prior to the failing command.
1) try some small width/height and execute it where the script usually succeeds, and see what happens
2) set to some large value and execute it on Jenkins, where it usually fails.
Found the culprit - there was a flag RequireWindowFocus = true in InternetExplorerOptions which was causing the issue. After removing it I no longer get the error. This might be related to https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/5431.
I have tried the following solutions:
1) Increase timeout in client request.
2) Increase server ExecutionTimeout in web.config HTTPRuntime tag.
3) I have tried using both ASMX and WCF services. Even when the server page takes time (code behind), an error appears "ReadResponse() failed: The server did not return a response for this request.".
4) Change the application pool timeouts from IIS.
5) Change the IIS > My website > HTTP response header > Set common headers > Enable/Disable HTTP alive
I am using following code to test server timeout issue:
[WebMethod]
public string LongRequest(int delaySeconds)
{
Thread.Sleep(delaySeconds*1000);
return "Delayed for " + delaySeconds + " Seconds";
}
We have different servers but this issue is appearing only on one server.
Note! This issue only appears when a request takes more than 40 seconds. (this time is not specific as it increases decreases everytime)
Issue resolved. I figured out that server switches were configured to close longer requests. I have now used internal IP of the server (which is accessible from our other servers only).
I have built an api to handle my application and i'm using a controller to upload files with FlowJS. It works with no problems on my local machine and also on my development server but when i use it on my client's homologation server i get a problem with the requisitions.
After some requests, it's a random number or requests sometimes 5 sometimes 10, the next request just freezes and won't respond and if i try to duplicate it using Chrome dev console it works.
This is a print of the requests:
The controller and service that are called only have IO operations and i'm logging everything that is done there after the request reaches the controller and when i get that pending status then request isn't logged.
I have also tried to work around my DNS to check if it was a connection problem due to the amount of requisitions but the problem remais the same. What else could be happening here ?
i have developed a server application with c# and a client application with flash action script 3.0. Flash socket asking for a policy file when called from a browser with a message
<policy-file-request/>
everything is normal so far. My server is waiting for this message and sending to client a policy file string which is like this:
public const String POLICY_FILE = "<?xml version=\"1.0\"?>\n" +
"<!DOCTYPE cross-domain-policy SYSTEM \"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd\">\n" +
"<cross-domain-policy>" +
"<allow-access-from domain=\"*\" to-ports=\"*\" />" +
"</cross-domain-policy>\u0000";
this string is being sent this way:
if (message.Contains("policy-file-request"))
{
client.Send(Encoding.ASCII.GetBytes(Statics.POLICY_FILE));
return;
}
I'm pretty sure that this was working but i really don't know what happened and started not working. When flash client receives this message from server, connection was succesfull and everything was going how it had to go. But now the flash client waits 20 seconds (timeout of flash socket) and throws security exception
[SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]
I'm stuck and can't move forward. I'm listening to port 963, server machine fully qualified name is "mypc.domain.local" which can be accessible across my network. there is also an IIS running on this machine and the flash application is hosted here.
http://mypc.domain.local:90/page.html
this is the way, i call my flash application and
mypc.domain.local:963
is the address of server running. i am also working on this machine. i tried calling the page http://localhost:90/page.html or http://127.0.0.1:90/page.html and also tried the connection to server as localhost:963 or 127.0.0.1:963. same result on every combination.
What is wrong here? what could have been changed causing my working code broke down?
Thanks.
It's hard to tell without more code, but based on what you've shown, it appears that when that request comes in, you respond with the contents of the policy file, which isn't an actual valid HTTP response. My guess for the 20 second timeout would be that it's still waiting for the HTTP headers.
If possible, try to use the HTTP classes already in the BCL instead of doing http 'manually', but if you have to do the socket stuff yourself, then use something like Fiddler during debugging since it's great for identifying violations of the HTTP protocol.