Skip to content
New issue

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

You must write ContentLength bytes to the request stream before calling [Begin]GetResponse #47

Open
dandraka opened this issue Nov 30, 2022 · 0 comments

Comments

@dandraka
Copy link

dandraka commented Nov 30, 2022

Hi

I'm getting this error in Get-RabbitMQMessage.ps1 line 131 (the REST call):
"You must write ContentLength bytes to the request stream before calling [Begin]GetResponse."

The weird thing is that I'm getting this error always when I run this as a scheduled task (we use JAMS Scheduler in the shop). When I run it from ISE, mostly it runs fine but from time to time I get the same error. I cannot find a factor that causes it persistantly (e.g. when the queue is empty, or not empty etc etc).

My code is pretty vanilla:

# I need this when running as a scheduled task otherwise I get a different error
# Unable to find type [System.Web.HttpUtility]
Add-Type -AssemblyName System.Web 

[string]$url = 'https://localhost:8443/'
[string]$vhost = 'myvhost'
[string]$queue = 'myqueue'
[int]$maxMessageBatch = 10
$queueContent = Get-RabbitMQMessage -Name $queue -VirtualHost $vhost -BaseUri $url -Count $maxMessageBatch

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant