I am using .net Core and when I deployed my code I got the message "You do not have permission to view this directory or page." on my Azure´s App Service URL. Before the deployment I did not get this error.
My problem is that when I am trying to google this error I keep getting results that I have to make some adjustments in my web.config but .net Core does not have file. Deploying the program and using localhost works to make api calls works.
Anyone else here encounter the same problem using .net Core and figured out what the problem was???
Here is my Startup.cs file
public class Startup
{
public IConfigurationRoot Configuration {get; set;}
public static string ConnectionString {get; set;}
// public Startup(IConfiguration configuration)
// {
// Configuration = configuration;
// }
public Startup(IHostingEnvironment env){
Configuration = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json")
.Build();
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseMvc();
ConnectionString = Configuration["ConnectionStrings:TestingConnection"];
}
}
Configure
method:app.UseDefaultFiles();
app.UseMvcWithDefaultRoute();
app.UseStaticFiles();
– Rafael Herscovici