私は新しいことを学び、それを学びたいと思っています。私は簡単なHello Worldサーバを書いて、C# console application
でアクセスしようとしています。ここに私のサーバーは、次のとおりです。C#クライアントGOサーバー
package main
import (
"fmt"
"net/"
"github.com/labstack/echo"
)
func main(){
fmt.Println("Welcome to the Server!")
e:=echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Yallo from the Server! \n")
})
}
私はMozilla
と連携this.Itためlabstack/echo
パッケージを使用しています。 ここは私のクライアントです。
static void Main(string[] args)
{
var client = new HttpClient();
string responseString = string.Empty;
var task = new Task(async() =>
{
responseString = await client.GetStringAsync("localhost:8000");
});
task.Start();
task.Wait();
Console.WriteLine(responseString);
Console.ReadKey();
}
しかし、私はエラーを取得しています:
An exception of type 'System.ArgumentException' occurred in System.Net.Http.dll but was not handled in user code
Only 'http' and 'https' schemes are allowed.
変更 'client.GetStringAsync( "localhostを:8000");' 'client.GetStringAsync( "のhttp:// localhostを:8000")に;' – levent