Guest User

Untitled

a guest
Mar 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. public void ConfigureServices(IServiceCollection services)
  2. {
  3. WriteToFile("In configure service");
  4. try
  5. {
  6. // Enable Cors
  7. services.AddCors();
  8. services.AddMvc();
  9. }
  10. catch
  11. {
  12. WriteToFile("Not Connected in StartUP");
  13. }
  14. }
  15.  
  16. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  17. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  18. {
  19. try
  20. {
  21. app.UseCors(builder =>
  22. builder.AllowAnyOrigin()
  23. .AllowAnyHeader()
  24. .AllowAnyMethod());
  25.  
  26. app.UseMvc();
  27.  
  28. WriteToFile("After cors use In configure");
  29.  
  30. }
  31. catch(Exception ex)
  32. {
  33. WriteToFile("Error in configure"+ex.Message);
  34. }
  35. }
Add Comment
Please, Sign In to add comment