{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/wcf/pulls/comments/37776357","id":37776357,"diff_hunk":"@@ -18,10 +21,174 @@ private static void Main(string[] args)\n         {\n             CommandLineArguments commandLineArgs = new CommandLineArguments(args);\n \n+            Console.WriteLine(\"Specified BridgeConfiguration is:{0}{1}\",\n+                                Environment.NewLine, commandLineArgs.BridgeConfiguration.ToString());\n+\n+            // If asked to ping (not the default), just ping and return an exit code indicating its state\n+            if (commandLineArgs.Ping)\n+            {\n+                string pingResult = PingBridge(commandLineArgs.BridgeConfiguration.BridgeHost,\n+                               commandLineArgs.BridgeConfiguration.BridgePort);\n+                if (pingResult == null)\n+                {\n+                    Console.WriteLine(\"The Bridge is running.\");\n+                    Environment.Exit(0);\n+                }\n+                else\n+                {\n+                    Console.WriteLine(\"The Bridge is not running: {0}\", pingResult);\n+                    Environment.Exit(1);\n+                }\n+            }\n+            else if (commandLineArgs.StopIfLocal)\n+            {\n+                StopBridgeIfLocal(commandLineArgs);\n+            }\n+            else if (commandLineArgs.Stop)\n+            {\n+                StopBridge(commandLineArgs);\n+            }\n+            else\n+            {\n+                // Default action is starting the Bridge\n+                StartBridge(commandLineArgs);\n+            }\n+        }\n+\n+        private static string PingBridge(string host, int port)\n+        {\n+            string bridgeUrl = String.Format(\"http://{0}:{1}/Bridge\", host, port);\n+\n+            using (HttpClient httpClient = new HttpClient())\n+            {\n+                Console.WriteLine(\"Testing Bridge at {0}\", bridgeUrl);\n+                try\n+                {\n+                    var response = httpClient.GetAsync(bridgeUrl).GetAwaiter().GetResult();\n+                    if (!response.IsSuccessStatusCode)\n+                    {\n+                        string reason = String.Format(\"{0}Bridge returned unexpected status code='{1}', reason='{2}'\",\n+                                                    Environment.NewLine, response.StatusCode, response.ReasonPhrase);\n+                        if (response.Content != null)\n+                        {\n+                            string contentAsString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();\n+                            if (contentAsString.Length > 1000)\n+                            {\n+                                contentAsString = contentAsString.Substring(0, 999) + \"...\";\n+                            }\n+                            reason = String.Format(\"{0}, content:{1}{2}\",","path":"src/System.Private.ServiceModel/tools/test/Bridge/Bridge/Program.cs","position":71,"original_position":71,"commit_id":"79d34e8393d23cd959f3df90fabb1b675ced824c","original_commit_id":"79d34e8393d23cd959f3df90fabb1b675ced824c","user":{"login":"dmetzgar","id":2986365,"avatar_url":"https://avatars.githubusercontent.com/u/2986365?v=3","gravatar_id":"","url":"https://api.github.com/users/dmetzgar","html_url":"https://github.com/dmetzgar","followers_url":"https://api.github.com/users/dmetzgar/followers","following_url":"https://api.github.com/users/dmetzgar/following{/other_user}","gists_url":"https://api.github.com/users/dmetzgar/gists{/gist_id}","starred_url":"https://api.github.com/users/dmetzgar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmetzgar/subscriptions","organizations_url":"https://api.github.com/users/dmetzgar/orgs","repos_url":"https://api.github.com/users/dmetzgar/repos","events_url":"https://api.github.com/users/dmetzgar/events{/privacy}","received_events_url":"https://api.github.com/users/dmetzgar/received_events","type":"User","site_admin":false},"body":"Status code and reason are not written to Console if there is response content. Is this intentional?","created_at":"2015-08-24T17:20:27Z","updated_at":"2015-08-24T17:20:27Z","html_url":"https://github.com/dotnet/wcf/pull/290#discussion_r37776357","pull_request_url":"https://api.github.com/repos/dotnet/wcf/pulls/290","_links":{"self":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/comments/37776357"},"html":{"href":"https://github.com/dotnet/wcf/pull/290#discussion_r37776357"},"pull_request":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/290"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/wcf/pulls/290","id":43197422,"html_url":"https://github.com/dotnet/wcf/pull/290","diff_url":"https://github.com/dotnet/wcf/pull/290.diff","patch_url":"https://github.com/dotnet/wcf/pull/290.patch","issue_url":"https://api.github.com/repos/dotnet/wcf/issues/290","number":290,"state":"open","locked":false,"title":"Bridge as admin","user":{"login":"roncain","id":3913124,"avatar_url":"https://avatars.githubusercontent.com/u/3913124?v=3","gravatar_id":"","url":"https://api.github.com/users/roncain","html_url":"https://github.com/roncain","followers_url":"https://api.github.com/users/roncain/followers","following_url":"https://api.github.com/users/roncain/following{/other_user}","gists_url":"https://api.github.com/users/roncain/gists{/gist_id}","starred_url":"https://api.github.com/users/roncain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roncain/subscriptions","organizations_url":"https://api.github.com/users/roncain/orgs","repos_url":"https://api.github.com/users/roncain/repos","events_url":"https://api.github.com/users/roncain/events{/privacy}","received_events_url":"https://api.github.com/users/roncain/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-24T17:03:01Z","updated_at":"2015-08-24T17:20:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc94bdd91a70f5116290aa8c9ac5d24035f31cb0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/wcf/pulls/290/commits","review_comments_url":"https://api.github.com/repos/dotnet/wcf/pulls/290/comments","review_comment_url":"https://api.github.com/repos/dotnet/wcf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/wcf/issues/290/comments","statuses_url":"https://api.github.com/repos/dotnet/wcf/statuses/79d34e8393d23cd959f3df90fabb1b675ced824c","head":{"label":"roncain:bridge-as-admin","ref":"bridge-as-admin","sha":"79d34e8393d23cd959f3df90fabb1b675ced824c","user":{"login":"roncain","id":3913124,"avatar_url":"https://avatars.githubusercontent.com/u/3913124?v=3","gravatar_id":"","url":"https://api.github.com/users/roncain","html_url":"https://github.com/roncain","followers_url":"https://api.github.com/users/roncain/followers","following_url":"https://api.github.com/users/roncain/following{/other_user}","gists_url":"https://api.github.com/users/roncain/gists{/gist_id}","starred_url":"https://api.github.com/users/roncain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roncain/subscriptions","organizations_url":"https://api.github.com/users/roncain/orgs","repos_url":"https://api.github.com/users/roncain/repos","events_url":"https://api.github.com/users/roncain/events{/privacy}","received_events_url":"https://api.github.com/users/roncain/received_events","type":"User","site_admin":false},"repo":{"id":39504510,"name":"wcf","full_name":"roncain/wcf","owner":{"login":"roncain","id":3913124,"avatar_url":"https://avatars.githubusercontent.com/u/3913124?v=3","gravatar_id":"","url":"https://api.github.com/users/roncain","html_url":"https://github.com/roncain","followers_url":"https://api.github.com/users/roncain/followers","following_url":"https://api.github.com/users/roncain/following{/other_user}","gists_url":"https://api.github.com/users/roncain/gists{/gist_id}","starred_url":"https://api.github.com/users/roncain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roncain/subscriptions","organizations_url":"https://api.github.com/users/roncain/orgs","repos_url":"https://api.github.com/users/roncain/repos","events_url":"https://api.github.com/users/roncain/events{/privacy}","received_events_url":"https://api.github.com/users/roncain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/roncain/wcf","description":"This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.","fork":true,"url":"https://api.github.com/repos/roncain/wcf","forks_url":"https://api.github.com/repos/roncain/wcf/forks","keys_url":"https://api.github.com/repos/roncain/wcf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/roncain/wcf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/roncain/wcf/teams","hooks_url":"https://api.github.com/repos/roncain/wcf/hooks","issue_events_url":"https://api.github.com/repos/roncain/wcf/issues/events{/number}","events_url":"https://api.github.com/repos/roncain/wcf/events","assignees_url":"https://api.github.com/repos/roncain/wcf/assignees{/user}","branches_url":"https://api.github.com/repos/roncain/wcf/branches{/branch}","tags_url":"https://api.github.com/repos/roncain/wcf/tags","blobs_url":"https://api.github.com/repos/roncain/wcf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/roncain/wcf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/roncain/wcf/git/refs{/sha}","trees_url":"https://api.github.com/repos/roncain/wcf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/roncain/wcf/statuses/{sha}","languages_url":"https://api.github.com/repos/roncain/wcf/languages","stargazers_url":"https://api.github.com/repos/roncain/wcf/stargazers","contributors_url":"https://api.github.com/repos/roncain/wcf/contributors","subscribers_url":"https://api.github.com/repos/roncain/wcf/subscribers","subscription_url":"https://api.github.com/repos/roncain/wcf/subscription","commits_url":"https://api.github.com/repos/roncain/wcf/commits{/sha}","git_commits_url":"https://api.github.com/repos/roncain/wcf/git/commits{/sha}","comments_url":"https://api.github.com/repos/roncain/wcf/comments{/number}","issue_comment_url":"https://api.github.com/repos/roncain/wcf/issues/comments{/number}","contents_url":"https://api.github.com/repos/roncain/wcf/contents/{+path}","compare_url":"https://api.github.com/repos/roncain/wcf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/roncain/wcf/merges","archive_url":"https://api.github.com/repos/roncain/wcf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/roncain/wcf/downloads","issues_url":"https://api.github.com/repos/roncain/wcf/issues{/number}","pulls_url":"https://api.github.com/repos/roncain/wcf/pulls{/number}","milestones_url":"https://api.github.com/repos/roncain/wcf/milestones{/number}","notifications_url":"https://api.github.com/repos/roncain/wcf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/roncain/wcf/labels{/name}","releases_url":"https://api.github.com/repos/roncain/wcf/releases{/id}","created_at":"2015-07-22T12:21:54Z","updated_at":"2015-07-22T12:21:56Z","pushed_at":"2015-08-24T17:02:10Z","git_url":"git://github.com/roncain/wcf.git","ssh_url":"git@github.com:roncain/wcf.git","clone_url":"https://github.com/roncain/wcf.git","svn_url":"https://github.com/roncain/wcf","homepage":"","size":1975,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"9cf85ca8a1d5c9ec07ec63c9b85ec3347eea05c7","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":35562993,"name":"wcf","full_name":"dotnet/wcf","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/wcf","description":"This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.","fork":false,"url":"https://api.github.com/repos/dotnet/wcf","forks_url":"https://api.github.com/repos/dotnet/wcf/forks","keys_url":"https://api.github.com/repos/dotnet/wcf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/wcf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/wcf/teams","hooks_url":"https://api.github.com/repos/dotnet/wcf/hooks","issue_events_url":"https://api.github.com/repos/dotnet/wcf/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/wcf/events","assignees_url":"https://api.github.com/repos/dotnet/wcf/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/wcf/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/wcf/tags","blobs_url":"https://api.github.com/repos/dotnet/wcf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/wcf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/wcf/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/wcf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/wcf/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/wcf/languages","stargazers_url":"https://api.github.com/repos/dotnet/wcf/stargazers","contributors_url":"https://api.github.com/repos/dotnet/wcf/contributors","subscribers_url":"https://api.github.com/repos/dotnet/wcf/subscribers","subscription_url":"https://api.github.com/repos/dotnet/wcf/subscription","commits_url":"https://api.github.com/repos/dotnet/wcf/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/wcf/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/wcf/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/wcf/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/wcf/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/wcf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/wcf/merges","archive_url":"https://api.github.com/repos/dotnet/wcf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/wcf/downloads","issues_url":"https://api.github.com/repos/dotnet/wcf/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/wcf/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/wcf/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/wcf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/wcf/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/wcf/releases{/id}","created_at":"2015-05-13T17:17:03Z","updated_at":"2015-08-23T17:54:46Z","pushed_at":"2015-08-24T17:03:01Z","git_url":"git://github.com/dotnet/wcf.git","ssh_url":"git@github.com:dotnet/wcf.git","clone_url":"https://github.com/dotnet/wcf.git","svn_url":"https://github.com/dotnet/wcf","homepage":"","size":4428,"stargazers_count":493,"watchers_count":493,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":142,"mirror_url":null,"open_issues_count":77,"forks":142,"open_issues":77,"watchers":493,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/290"},"html":{"href":"https://github.com/dotnet/wcf/pull/290"},"issue":{"href":"https://api.github.com/repos/dotnet/wcf/issues/290"},"comments":{"href":"https://api.github.com/repos/dotnet/wcf/issues/290/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/290/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/290/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/wcf/statuses/79d34e8393d23cd959f3df90fabb1b675ced824c"}}}}