0

I have a asp.net core web api project which I am trying to host in IIS 7.5.

As suggested by below article,

The configuration file 'appsettings.json' was not found and is not optional

Below is my "appsettings.json" file,

{
  "ConnectionStrings": {
"SchedulerConnection":   "Server=ABC\\SQL2012;Database=SchedulerDb;persist security info=True;Integrated Security=SSPI;"
 }
}

And in "startup.cs" I am getting connection string value like below,

public void ConfigureServices(IServiceCollection services)
    {
        services.AddDbContext<SchedulerContext>(options =>
                                                options.UseSqlServer(Configuration.GetConnectionString("SchedulerConnection"),
                                                b => b.MigrationsAssembly("WebTest.API")));
    }

The code running file in local IISExpress, but throw 500 Server Error while deploying to IIS 7.5.

What is wrong here? please suggest!!

Below is my "publishOptions",

"publishOptions": {
"include": [
  "wwwroot",
  "appsettings.json",
  "web.config"
]
 },
Community
  • 1
  • 1
user2994834
  • 387
  • 1
  • 4
  • 14
  • Now I am able to get connection string, but after hosting it to IIS 7.5, I am getting 500 Internal Server Error, any idea? – user2994834 Oct 15 '16 at 04:32

2 Answers2

0

Create a new login "IIS APPPOOL[App Pool Name]" for SQL Server and later assign website/IIS application to "IIS APPPOOL[App Pool Name]" works for me.

Thanks,

user2994834
  • 387
  • 1
  • 4
  • 14
0

Point the server to *\bin\Release\PublishOutput .

Select ApplicationPool .Net Framework version as "No managed code." and Process Model->Identity as LocalSystem.

Restart both.

If same 500 error comes up then try self hosting it. Link: https://stackoverflow.com/questions/30298458

You will know the errors in your application.

Then Publish again and re-host.

Community
  • 1
  • 1
Jyotirmaya Prusty
  • 278
  • 1
  • 8
  • 25