Script# Call a Rest Service -
I tried to use this code in SCRIpt #
Uri uri = new Uri (string) .format (string.Concat ("http: // localhost: 49,175 / GetProjects"))); WebRequest requests = WebRequest.Create (uri); request. Method = WebRest Methods. Hpp gate; Request.ContentType = "App / Jason"; (WebResponse response = request.GetResponse ()) using {var reader = new system.io.streamreader (feedbackGetterSponsScream ())} {string tmp = reader.ReadToEnd (); Return JsonConvert.DeserializeObject & lt; List & lt; String & gt; & Gt; (TMP); }} But I have this error:
error 3 assembly 'C: \ program files (x86) \ reference assemblies \ Microsoft \ framework NETFramework \ v4.0 \ System.dll 'is not a valid script assembly.
Is this the way to use System.Net , system? IO.StreamReader and Newtonsoft.Json in script #? If this is impossible, how can I change this code?
I solved the problem like this string tfsIntegration = String.Format (string.Concat ("http: // localhost: 49175")); System.Net.XmlHttpRequest getProjectRequest = New System.Net.XmlHttpRequest (); GetProjectRequest.Open ("Receive", tfsIntegration + "/ GetProjects", False); GetProjectRequest.SetRequestHeader ("Accept", "Application / JS"); GetProjectRequest.SetRequestHeader ("Content Type", "Application / Jason; Charset = UTF-8"); GetProjectRequest.SetRequestHeader ("X-HTTP-Method", "Merge"); GetProjectRequest.Send (zero);
Comments
Post a Comment