Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. public static void Main(string[] args)
  2. {
  3. var config = new ConfigurationBuilder()
  4. .AddJsonFile("hosting.json", optional: true)
  5. .AddCommandLine(args)
  6. .Build();
  7.  
  8. var host = new WebHostBuilder()
  9. .UseKestrel()
  10. .UseContentRoot(Directory.GetCurrentDirectory())
  11. .UseIISIntegration()
  12. .UseStartup<Startup>()
  13. .UseConfiguration(config)
  14. .Build();
  15.  
  16. host.Run();
  17. }
  18.  
  19. public static void Main(string[] args)
  20. {
  21. BuildWebHost(args).Run();
  22. }
  23.  
  24. public static IWebHost BuildWebHost(string[] args)
  25. {
  26. return WebHost.CreateDefaultBuilder(args)
  27. .ConfigureLogging((context, logging) =>
  28. {
  29. logging.AddSerilog();
  30. })
  31. .UseStartup<Startup>()
  32. .Build();
  33. }
  34.  
  35. {
  36. "iisSettings": {
  37. "windowsAuthentication": false,
  38. "anonymousAuthentication": true,
  39. "iisExpress": {
  40. "applicationUrl": "http://localhost:5005/",
  41. "sslPort": 0
  42. }
  43. },
  44. "profiles": {
  45. "IIS Express": {
  46. "commandName": "IISExpress",
  47. "launchBrowser": true,
  48. "environmentVariables": {
  49. "ASPNETCORE_ENVIRONMENT": "Development"
  50. }
  51. },
  52. "Robert.Project.Web": {
  53. "commandName": "Project",
  54. "environmentVariables": {
  55. "ASPNETCORE_ENVIRONMENT": "Development"
  56. },
  57. "applicationUrl": "http://localhost:5006"
  58. }
  59. }
  60. }
  61.  
  62. public static IWebHost BuildWebHost(string[] args)
  63. {
  64. var config = new ConfigurationBuilder().AddCommandLine(args).Build();
  65.  
  66. return WebHost.CreateDefaultBuilder(args)
  67. .UseConfiguration(config)
  68. .UseStartup<Startup>()
  69. .Build();
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement