We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue: When trying to connect to a windows VM using a go program and fetching list of directories in loop for 5 times
If during this operation, windows VM network disconnects or network service restarts, the connection to windows VM breaks with following error:
Error while running command :unknown error Post "http://74.225.159.106:5985/wsman": net/http: timeout awaiting response headers
And then when retry is tried the connection fails with the following errors
:http response error: 401 - invalid content type
I already tried recreating endpoint and client object again during next retry once the connection fails during timeout but still same error occurs
endpoint config used:
winrm.NewEndpoint("", 5985, false, false, nil, nil, nil, 300)
winrm config:
Authentication used for winRM Client and Service: Basic Allow unencrypted traffic: true
Code used: // creating a new client object client, err = winrm.NewClient(endpoint, username, password)
loop start stdout, stderr, stdcode, err := client.RunWithString("dir", "") if err != nil { log.Println("Error creating connection and executing command: ", err) if max retry done: return err else: continue } if stdcode != 0 { log.Println("Error: encountered during executing command: ", err) if max retry done: return err else: continue } else { return nil }
return nil
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Issue:
When trying to connect to a windows VM using a go program and fetching list of directories in loop for 5 times
If during this operation, windows VM network disconnects or network service restarts, the connection to windows VM breaks with following error:
Error while running command :unknown error Post "http://74.225.159.106:5985/wsman": net/http: timeout awaiting response headers
And then when retry is tried the connection fails with the following errors
:http response error: 401 - invalid content type
I already tried recreating endpoint and client object again during next retry once the connection fails during timeout but still same error occurs
endpoint config used:
winrm.NewEndpoint("", 5985, false, false, nil, nil, nil, 300)
winrm config:
Authentication used for winRM Client and Service: Basic
Allow unencrypted traffic: true
Code used:
// creating a new client object
client, err = winrm.NewClient(endpoint, username, password)
loop start
stdout, stderr, stdcode, err := client.RunWithString("dir", "")
if err != nil {
log.Println("Error creating connection and executing command: ", err)
if max retry done:
return err
else: continue
}
if stdcode != 0 {
log.Println("Error: encountered during executing command: ", err)
if max retry done:
return err
else: continue
} else {
return nil
}
return nil
The text was updated successfully, but these errors were encountered: