Hi, I'm trying to make a little script in visual c# to get sessions on a c# console , but when i execute this from visual:
using (Runspace runspace = RunspaceFactory.CreateRunspace())
{
runspace.Open();
PowerShell ps = PowerShell.Create();
ps.Runspace = runspace;
PSSnapInException psex;
runspace.RunspaceConfiguration.AddPSSnapIn("Citrix.Broker.Admin.V2", out psex);
Pipeline pipeline = runspace.CreatePipeline();
Command getSession = new Command("Get-BrokerSession");
pipeline.Commands.Add(getSession);
//This line below is where the exception occurs.
Collection<PSObject> output = pipeline.Invoke();
foreach (PSObject x in output)
{
Console.Write(x.ToString());
}
}
I have this error:
Unhandled Exception: System.Management.Automation.CmdletInvocationException: Failed to connect to back-end server 'localhost' on port 80 using binding WSHttp. The server may be off-line or may not be running the appropriate service ---> Citrix.Broker.Admin.SDK.SdkOperationException: Failed to connect to back-end server 'localhost' on port 80 using binding WSHttp. The server may be off-line or may not be running the appropriate service ---> System.ServiceModel.CommunicationException: Failed to connect to back-end server 'localhost' on port 80 using binding WSHttp. The server may be off-line or may not be running the appropriate service ---> System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost/Citrix/BrokerAdminService/v2 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
Question
Henrry Ortiz
Hi, I'm trying to make a little script in visual c# to get sessions on a c# console , but when i execute this from visual:
using (Runspace runspace = RunspaceFactory.CreateRunspace())
{
runspace.Open();
PowerShell ps = PowerShell.Create();
ps.Runspace = runspace;
PSSnapInException psex;
runspace.RunspaceConfiguration.AddPSSnapIn("Citrix.Broker.Admin.V2", out psex);
Pipeline pipeline = runspace.CreatePipeline();
Command getSession = new Command("Get-BrokerSession");
pipeline.Commands.Add(getSession);
//This line below is where the exception occurs.
Collection<PSObject> output = pipeline.Invoke();
foreach (PSObject x in output)
{
Console.Write(x.ToString());
}
}
I have this error:
Unhandled Exception: System.Management.Automation.CmdletInvocationException: Failed to connect to back-end server 'localhost' on port 80 using binding WSHttp. The server may be off-line or may not be running the appropriate service ---> Citrix.Broker.Admin.SDK.SdkOperationException: Failed to connect to back-end server 'localhost' on port 80 using binding WSHttp. The server may be off-line or may not be running the appropriate service ---> System.ServiceModel.CommunicationException: Failed to connect to back-end server 'localhost' on port 80 using binding WSHttp. The server may be off-line or may not be running the appropriate service ---> System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost/Citrix/BrokerAdminService/v2 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
I have installed the SDK http://download.apps.cloud.com/CitrixPoshSdk.exe
I have installed Visual Studio on Cloud Connector and run on cloud connector.
If i run the commands from powershell, no problem, just only from visual generating the execuatble and running.
Link to comment
4 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now