0

I created a C# based chatbot project using bot framework v4, it works on my local but when I try to deploy it on Azure App Service, I get a 502 error, I tried to deploy a few different way. I try to use continues deployment using my company's GitBucket, I also try to deploy using the built in deploy command in Visual Studio, both way gave the same error. Here is web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\VirtualAgent.dll" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout" />
  </system.webServer>
</configuration>

Even if the chatbot itself doesn't work I should be able to at least hit the default.htm file? Even that doesn't work, here is my folder structure:

enter image description here

I copied the deploy.cmd and build.cmd from the sample EchoBot project, they don't seem to do anything.

This is the error I am getting, I searched online and it seem to be a generic error for when the server crash:

enter image description here

Here is my program.cs

public class Program
{
    public static void Main(string[] args)
    {
        SerilogHelper.Configure(nameof(VirtualAgent));
        try
        {
            CreateWebHostBuilder(args).Build().Run();
        }
        catch (Exception ex)
        {
            SerilogHelper.UnhandledException(ex, nameof(Main));
        }
        finally
        {
            SerilogHelper.Finish();
        }
    }

    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .UseSerilog()
            .UseStartup<Startup>();
}

And also my Startup.cs

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // 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);

        // Add functionality to inject IOptions<T>
        services.AddOptions();

        // Add our Config object so it can be injected
        services.Configure<VirtualAgentConfig>(Configuration);

        // Create the Bot Framework Adapter with error handling enabled.
        services.AddSingleton<IBotFrameworkHttpAdapter, AdapterWithErrorHandler>();

        // .. /
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseHsts();
        }

        app.UseDefaultFiles();
        app.UseStaticFiles();
        app.UseWebSockets();
        app.UseMvc();
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.