Web api'ye erişen diğer ana bilgisayarlardan istemcileri etkinleştirmek için .UseUrls("http://*:5000")
hattını ekledim.Bağlantı noktası numarasını değiştirdikten sonra Visual Studio'da hata ayıklanamıyor mu?
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls("http://*:5000") // Added
.Build();
host.Run();
}
Ancak localhost:5000/api/Test
erişmek için tarayıcı kullanarak HTTP/1.1 400 Bad Request
ait hata var? .UseUrls()
sadece üretim için derlenmiş mi? test ederken
HTTP/1.1 400 Bad Request Date: Mon, 08 Aug 2016 21:42:30 GMT Content-Length: 0 Server: Kestrel
aşağıdaki mesajlar Görsel stüdyo Çıktı penceresinden kopyalanır.
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:5000/api/Test
Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware:Error: 'MS-ASPNETCORE-TOKEN' does not match the expected pairing token '9bca37f2-7eda-4517-9f8f-60b6cc05cf01', request rejected.
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 8.5976ms 400
"UseIISIntegration()" işlevinden önce UseUrls() 'ı arayabilirsiniz. bkz http://stackoverflow.com/questions/37862475/specifying-the-url-port-that-a-asp-net-core-1-0-webapi-exe-should-use-in-progr –
Lütfen onaylayın Bunu IIS, IISExpress veya bağımsız olarak çalıştırıyordunuz. –
'UseUrls() işlevini' UseIISIntegration() 'ın önüne taşıdım ve uygulama adını ayıklarken hata ayıkladığında çalışır. IIS express ile çalıştırıldığında hala çalışmıyor. – ca9163d9