Deployed Aspnet WebApi to IIS OK but return 500 internal Server Error When CRUD500 error while deploying asp.net core web api to IIS 7.5ASP.NET Core Web API 500 Internal Server ErrorASP.NET Web API CreatedAtRoute return 500 Internal Server ErrorASP.NET Core API - 500 internal server error,only on production500 Not Found Error When Calling Web APIError after deploying asp.net core angular in IIS Cannot find module 'aspnet-webpack' at Function.Module._resolveFilenameAsp.Net Core 2 Web API 500 internal server error.net core 500 internal server error after adding new api controllerNew Api return Internal Server Errorwhy does Asp.net core Web API 2.0 returns Http Error 500

meaning of に in 本当に?

What are these boxed doors outside store fronts in New York?

Is it inappropriate for a student to attend their mentor's dissertation defense?

Why are electrically insulating heatsinks so rare? Is it just cost?

How much RAM could one put in a typical 80386 setup?

Convert two switches to a dual stack, and add outlet - possible here?

Was any UN Security Council vote triple-vetoed?

What does it mean to describe someone as a butt steak?

What is a clear way to write a bar that has an extra beat?

Can I make popcorn with any corn?

What does the "remote control" for a QF-4 look like?

Definite integral giving negative value as a result?

Maximum likelihood parameters deviate from posterior distributions

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

NMaximize is not converging to a solution

How does quantile regression compare to logistic regression with the variable split at the quantile?

Do infinite dimensional systems make sense?

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

Cross compiling for RPi - error while loading shared libraries

Does detail obscure or enhance action?

What's the point of deactivating Num Lock on login screens?

Fully-Firstable Anagram Sets

LWC SFDX source push error TypeError: LWC1009: decl.moveTo is not a function

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?



Deployed Aspnet WebApi to IIS OK but return 500 internal Server Error When CRUD


500 error while deploying asp.net core web api to IIS 7.5ASP.NET Core Web API 500 Internal Server ErrorASP.NET Web API CreatedAtRoute return 500 Internal Server ErrorASP.NET Core API - 500 internal server error,only on production500 Not Found Error When Calling Web APIError after deploying asp.net core angular in IIS Cannot find module 'aspnet-webpack' at Function.Module._resolveFilenameAsp.Net Core 2 Web API 500 internal server error.net core 500 internal server error after adding new api controllerNew Api return Internal Server Errorwhy does Asp.net core Web API 2.0 returns Http Error 500






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am just starting asp.net Core 2.0 web api. Please extend your help.



I have successfully deployed the asp.net WebApi app to Local IIS and
I have created a database in Sql Server 2017 (free version) with below code.



problem: status 500 internal server error when I do a post with PostMan



 1) in StartUp.cs with ConnectionString:

public void ConfigureServices(IServiceCollection services)

services.AddMvc();

services.AddDbContext<ContactContext>(option => option.UseSqlServer(Configuration.GetConnectionString("Default")));



2) connection string in appsettings.json

"connectionstrings":
"Default": "Server = .\SQL2017Express; Database = ContactDB; Integrated Security = True;"



**The Problems Encountered:**

problem: status 500 internal server error when I do a post with PostMan

Post : http://192.168.1.8:8989/api/contacts

Json Data for the Body in PostMan:

"FirstName" : "John",
"LastName" : "David",
"MobilePhone" : "123456789"


// controller
[Produces("application/json")]
[Route("api/[controller]")]
public class ContactsController : Controller

public IContactRepository ContactsRepo get; set;

public ContactsController(IContactRepository _repo)

ContactsRepo = _repo;


[HttpGet]
public async Task<IActionResult> GetAll()

var contactList = await ContactsRepo.GetAll();
return Ok(contactList);


[HttpGet("id", Name = "GetContacts")]
public async Task<IActionResult> GetById(string id)

var item = await ContactsRepo.Find(id);
if (item == null)

return NotFound();

return Ok(item);


[HttpPost]
public async Task<IActionResult> Create([FromBody] Contacts item)

if (item == null)

return BadRequest();

await ContactsRepo.Add(item);
return CreatedAtRoute("GetContacts", new Controller = "Contacts", id = item.MobilePhone , item);


[HttpPut("id")]
public async Task<IActionResult> Update(string id, [FromBody] Contacts item)

if (item == null)

return BadRequest();

var contactObj = await ContactsRepo.Find(id);
if (contactObj == null)

return NotFound();

await ContactsRepo.Update(item);
return NoContent();


[HttpDelete("id")]
public async Task<IActionResult> Delete(string id)

await ContactsRepo.Remove(id);
return NoContent();




I have tried both type of connection string:



a)
"connectionstrings":
"Default": "Server = .\SQL2017Express; Database = ContactDB; Integrated Security = True;"
,
b)
"connectionstrings":
"Default": "Server = .\SQL2017Express; Database = ContactDB; User Id=sa; Password=xxxxx ; Integrated Security = True;"
,









share|improve this question




























    0















    I am just starting asp.net Core 2.0 web api. Please extend your help.



    I have successfully deployed the asp.net WebApi app to Local IIS and
    I have created a database in Sql Server 2017 (free version) with below code.



    problem: status 500 internal server error when I do a post with PostMan



     1) in StartUp.cs with ConnectionString:

    public void ConfigureServices(IServiceCollection services)

    services.AddMvc();

    services.AddDbContext<ContactContext>(option => option.UseSqlServer(Configuration.GetConnectionString("Default")));



    2) connection string in appsettings.json

    "connectionstrings":
    "Default": "Server = .\SQL2017Express; Database = ContactDB; Integrated Security = True;"



    **The Problems Encountered:**

    problem: status 500 internal server error when I do a post with PostMan

    Post : http://192.168.1.8:8989/api/contacts

    Json Data for the Body in PostMan:

    "FirstName" : "John",
    "LastName" : "David",
    "MobilePhone" : "123456789"


    // controller
    [Produces("application/json")]
    [Route("api/[controller]")]
    public class ContactsController : Controller

    public IContactRepository ContactsRepo get; set;

    public ContactsController(IContactRepository _repo)

    ContactsRepo = _repo;


    [HttpGet]
    public async Task<IActionResult> GetAll()

    var contactList = await ContactsRepo.GetAll();
    return Ok(contactList);


    [HttpGet("id", Name = "GetContacts")]
    public async Task<IActionResult> GetById(string id)

    var item = await ContactsRepo.Find(id);
    if (item == null)

    return NotFound();

    return Ok(item);


    [HttpPost]
    public async Task<IActionResult> Create([FromBody] Contacts item)

    if (item == null)

    return BadRequest();

    await ContactsRepo.Add(item);
    return CreatedAtRoute("GetContacts", new Controller = "Contacts", id = item.MobilePhone , item);


    [HttpPut("id")]
    public async Task<IActionResult> Update(string id, [FromBody] Contacts item)

    if (item == null)

    return BadRequest();

    var contactObj = await ContactsRepo.Find(id);
    if (contactObj == null)

    return NotFound();

    await ContactsRepo.Update(item);
    return NoContent();


    [HttpDelete("id")]
    public async Task<IActionResult> Delete(string id)

    await ContactsRepo.Remove(id);
    return NoContent();




    I have tried both type of connection string:



    a)
    "connectionstrings":
    "Default": "Server = .\SQL2017Express; Database = ContactDB; Integrated Security = True;"
    ,
    b)
    "connectionstrings":
    "Default": "Server = .\SQL2017Express; Database = ContactDB; User Id=sa; Password=xxxxx ; Integrated Security = True;"
    ,









    share|improve this question
























      0












      0








      0








      I am just starting asp.net Core 2.0 web api. Please extend your help.



      I have successfully deployed the asp.net WebApi app to Local IIS and
      I have created a database in Sql Server 2017 (free version) with below code.



      problem: status 500 internal server error when I do a post with PostMan



       1) in StartUp.cs with ConnectionString:

      public void ConfigureServices(IServiceCollection services)

      services.AddMvc();

      services.AddDbContext<ContactContext>(option => option.UseSqlServer(Configuration.GetConnectionString("Default")));



      2) connection string in appsettings.json

      "connectionstrings":
      "Default": "Server = .\SQL2017Express; Database = ContactDB; Integrated Security = True;"



      **The Problems Encountered:**

      problem: status 500 internal server error when I do a post with PostMan

      Post : http://192.168.1.8:8989/api/contacts

      Json Data for the Body in PostMan:

      "FirstName" : "John",
      "LastName" : "David",
      "MobilePhone" : "123456789"


      // controller
      [Produces("application/json")]
      [Route("api/[controller]")]
      public class ContactsController : Controller

      public IContactRepository ContactsRepo get; set;

      public ContactsController(IContactRepository _repo)

      ContactsRepo = _repo;


      [HttpGet]
      public async Task<IActionResult> GetAll()

      var contactList = await ContactsRepo.GetAll();
      return Ok(contactList);


      [HttpGet("id", Name = "GetContacts")]
      public async Task<IActionResult> GetById(string id)

      var item = await ContactsRepo.Find(id);
      if (item == null)

      return NotFound();

      return Ok(item);


      [HttpPost]
      public async Task<IActionResult> Create([FromBody] Contacts item)

      if (item == null)

      return BadRequest();

      await ContactsRepo.Add(item);
      return CreatedAtRoute("GetContacts", new Controller = "Contacts", id = item.MobilePhone , item);


      [HttpPut("id")]
      public async Task<IActionResult> Update(string id, [FromBody] Contacts item)

      if (item == null)

      return BadRequest();

      var contactObj = await ContactsRepo.Find(id);
      if (contactObj == null)

      return NotFound();

      await ContactsRepo.Update(item);
      return NoContent();


      [HttpDelete("id")]
      public async Task<IActionResult> Delete(string id)

      await ContactsRepo.Remove(id);
      return NoContent();




      I have tried both type of connection string:



      a)
      "connectionstrings":
      "Default": "Server = .\SQL2017Express; Database = ContactDB; Integrated Security = True;"
      ,
      b)
      "connectionstrings":
      "Default": "Server = .\SQL2017Express; Database = ContactDB; User Id=sa; Password=xxxxx ; Integrated Security = True;"
      ,









      share|improve this question














      I am just starting asp.net Core 2.0 web api. Please extend your help.



      I have successfully deployed the asp.net WebApi app to Local IIS and
      I have created a database in Sql Server 2017 (free version) with below code.



      problem: status 500 internal server error when I do a post with PostMan



       1) in StartUp.cs with ConnectionString:

      public void ConfigureServices(IServiceCollection services)

      services.AddMvc();

      services.AddDbContext<ContactContext>(option => option.UseSqlServer(Configuration.GetConnectionString("Default")));



      2) connection string in appsettings.json

      "connectionstrings":
      "Default": "Server = .\SQL2017Express; Database = ContactDB; Integrated Security = True;"



      **The Problems Encountered:**

      problem: status 500 internal server error when I do a post with PostMan

      Post : http://192.168.1.8:8989/api/contacts

      Json Data for the Body in PostMan:

      "FirstName" : "John",
      "LastName" : "David",
      "MobilePhone" : "123456789"


      // controller
      [Produces("application/json")]
      [Route("api/[controller]")]
      public class ContactsController : Controller

      public IContactRepository ContactsRepo get; set;

      public ContactsController(IContactRepository _repo)

      ContactsRepo = _repo;


      [HttpGet]
      public async Task<IActionResult> GetAll()

      var contactList = await ContactsRepo.GetAll();
      return Ok(contactList);


      [HttpGet("id", Name = "GetContacts")]
      public async Task<IActionResult> GetById(string id)

      var item = await ContactsRepo.Find(id);
      if (item == null)

      return NotFound();

      return Ok(item);


      [HttpPost]
      public async Task<IActionResult> Create([FromBody] Contacts item)

      if (item == null)

      return BadRequest();

      await ContactsRepo.Add(item);
      return CreatedAtRoute("GetContacts", new Controller = "Contacts", id = item.MobilePhone , item);


      [HttpPut("id")]
      public async Task<IActionResult> Update(string id, [FromBody] Contacts item)

      if (item == null)

      return BadRequest();

      var contactObj = await ContactsRepo.Find(id);
      if (contactObj == null)

      return NotFound();

      await ContactsRepo.Update(item);
      return NoContent();


      [HttpDelete("id")]
      public async Task<IActionResult> Delete(string id)

      await ContactsRepo.Remove(id);
      return NoContent();




      I have tried both type of connection string:



      a)
      "connectionstrings":
      "Default": "Server = .\SQL2017Express; Database = ContactDB; Integrated Security = True;"
      ,
      b)
      "connectionstrings":
      "Default": "Server = .\SQL2017Express; Database = ContactDB; User Id=sa; Password=xxxxx ; Integrated Security = True;"
      ,






      asp.net-core-2.0 asp.net-core-webapi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 15 '18 at 12:43









      MilkBottleMilkBottle

      1,667442103




      1,667442103






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Looks to me like you have an issue connecting to the SQL instance. Unless you have more than one instance of SQL server running you would best un-install the software and install it as the default instance. This just makes configurations so much easier.



          If you have SSMS (Sql Server Management Studio) installed on your webserver then open and type select @@servername this gives the name of your actual instance.



          You can also see the name in the service, I have a default instance, hence you see no name



          -s swich defining the instance



          Please make sure you know the performance and size limitations of SQL server express before you deploy this too production.



          Have you had a look at SQL Server configuration manager (you may need to install it)



          Protocols



          You need to make sure that if you're not using TCP but DMA or Pipes to use the proper connection string; have you considered:



          \<computer_name>pipeMSSQL$<instance_name>


          Have a look at this URL.






          share|improve this answer

























          • @Walter: Follow your advice, I checked mine settings are :Sharedmemory: Enabled, Named Pipes: Disabled, TCP/IP : Disabled. I have only one Installed which is SQL2017Express. But I still can not do the CRUD with WebApi. The connectionString is correct.

            – MilkBottle
            Apr 15 '18 at 13:43











          • Can you log the error to a log file? What you do is in your ContactsController constructor you add a parameter ILogger<ContactsController > logger and save it as a class fiel. Then wrap the execution in a try catch and log like this catch (Exception e) _logger.LogError( e) the error, you will see the error on disk after you update your webconfig

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:27












          • you need to go to the webserver and look at where you published the app there will be a web.config file navigate to <aspNetCore> element in webconfig and set stdoutLogEnabled="true" stdoutLogFile="D:InetpublogWebAppName" where webname is any name you like the directory should exist and should not be available to the public as hacjers that cause errors will read it to gain infrmation on the possible attack vectors

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:34











          • @Walter: I have the web.config file in the Deployment Folder in C-drive. The Website in WebServer also has a web.config in AsNetCoreModule. Can I change the one in C-drive and Publish? Which One I Should change? Just set stdoutLogEnabled = true, while stdoutLogFile=".logsstdout" remain the same.

            – MilkBottle
            Apr 16 '18 at 13:26











          • @Walter I can get the log file after implemented the ILogger without change the stdoutLogEnabled = true. I dont change anything in web.config. My Error is 502.3 Bad Gateway. How to fix this problem? This error is captured by PostMan which used to test Api.

            – MilkBottle
            Apr 16 '18 at 13:39












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49842044%2fdeployed-aspnet-webapi-to-iis-ok-but-return-500-internal-server-error-when-crud%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Looks to me like you have an issue connecting to the SQL instance. Unless you have more than one instance of SQL server running you would best un-install the software and install it as the default instance. This just makes configurations so much easier.



          If you have SSMS (Sql Server Management Studio) installed on your webserver then open and type select @@servername this gives the name of your actual instance.



          You can also see the name in the service, I have a default instance, hence you see no name



          -s swich defining the instance



          Please make sure you know the performance and size limitations of SQL server express before you deploy this too production.



          Have you had a look at SQL Server configuration manager (you may need to install it)



          Protocols



          You need to make sure that if you're not using TCP but DMA or Pipes to use the proper connection string; have you considered:



          \<computer_name>pipeMSSQL$<instance_name>


          Have a look at this URL.






          share|improve this answer

























          • @Walter: Follow your advice, I checked mine settings are :Sharedmemory: Enabled, Named Pipes: Disabled, TCP/IP : Disabled. I have only one Installed which is SQL2017Express. But I still can not do the CRUD with WebApi. The connectionString is correct.

            – MilkBottle
            Apr 15 '18 at 13:43











          • Can you log the error to a log file? What you do is in your ContactsController constructor you add a parameter ILogger<ContactsController > logger and save it as a class fiel. Then wrap the execution in a try catch and log like this catch (Exception e) _logger.LogError( e) the error, you will see the error on disk after you update your webconfig

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:27












          • you need to go to the webserver and look at where you published the app there will be a web.config file navigate to <aspNetCore> element in webconfig and set stdoutLogEnabled="true" stdoutLogFile="D:InetpublogWebAppName" where webname is any name you like the directory should exist and should not be available to the public as hacjers that cause errors will read it to gain infrmation on the possible attack vectors

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:34











          • @Walter: I have the web.config file in the Deployment Folder in C-drive. The Website in WebServer also has a web.config in AsNetCoreModule. Can I change the one in C-drive and Publish? Which One I Should change? Just set stdoutLogEnabled = true, while stdoutLogFile=".logsstdout" remain the same.

            – MilkBottle
            Apr 16 '18 at 13:26











          • @Walter I can get the log file after implemented the ILogger without change the stdoutLogEnabled = true. I dont change anything in web.config. My Error is 502.3 Bad Gateway. How to fix this problem? This error is captured by PostMan which used to test Api.

            – MilkBottle
            Apr 16 '18 at 13:39
















          0














          Looks to me like you have an issue connecting to the SQL instance. Unless you have more than one instance of SQL server running you would best un-install the software and install it as the default instance. This just makes configurations so much easier.



          If you have SSMS (Sql Server Management Studio) installed on your webserver then open and type select @@servername this gives the name of your actual instance.



          You can also see the name in the service, I have a default instance, hence you see no name



          -s swich defining the instance



          Please make sure you know the performance and size limitations of SQL server express before you deploy this too production.



          Have you had a look at SQL Server configuration manager (you may need to install it)



          Protocols



          You need to make sure that if you're not using TCP but DMA or Pipes to use the proper connection string; have you considered:



          \<computer_name>pipeMSSQL$<instance_name>


          Have a look at this URL.






          share|improve this answer

























          • @Walter: Follow your advice, I checked mine settings are :Sharedmemory: Enabled, Named Pipes: Disabled, TCP/IP : Disabled. I have only one Installed which is SQL2017Express. But I still can not do the CRUD with WebApi. The connectionString is correct.

            – MilkBottle
            Apr 15 '18 at 13:43











          • Can you log the error to a log file? What you do is in your ContactsController constructor you add a parameter ILogger<ContactsController > logger and save it as a class fiel. Then wrap the execution in a try catch and log like this catch (Exception e) _logger.LogError( e) the error, you will see the error on disk after you update your webconfig

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:27












          • you need to go to the webserver and look at where you published the app there will be a web.config file navigate to <aspNetCore> element in webconfig and set stdoutLogEnabled="true" stdoutLogFile="D:InetpublogWebAppName" where webname is any name you like the directory should exist and should not be available to the public as hacjers that cause errors will read it to gain infrmation on the possible attack vectors

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:34











          • @Walter: I have the web.config file in the Deployment Folder in C-drive. The Website in WebServer also has a web.config in AsNetCoreModule. Can I change the one in C-drive and Publish? Which One I Should change? Just set stdoutLogEnabled = true, while stdoutLogFile=".logsstdout" remain the same.

            – MilkBottle
            Apr 16 '18 at 13:26











          • @Walter I can get the log file after implemented the ILogger without change the stdoutLogEnabled = true. I dont change anything in web.config. My Error is 502.3 Bad Gateway. How to fix this problem? This error is captured by PostMan which used to test Api.

            – MilkBottle
            Apr 16 '18 at 13:39














          0












          0








          0







          Looks to me like you have an issue connecting to the SQL instance. Unless you have more than one instance of SQL server running you would best un-install the software and install it as the default instance. This just makes configurations so much easier.



          If you have SSMS (Sql Server Management Studio) installed on your webserver then open and type select @@servername this gives the name of your actual instance.



          You can also see the name in the service, I have a default instance, hence you see no name



          -s swich defining the instance



          Please make sure you know the performance and size limitations of SQL server express before you deploy this too production.



          Have you had a look at SQL Server configuration manager (you may need to install it)



          Protocols



          You need to make sure that if you're not using TCP but DMA or Pipes to use the proper connection string; have you considered:



          \<computer_name>pipeMSSQL$<instance_name>


          Have a look at this URL.






          share|improve this answer















          Looks to me like you have an issue connecting to the SQL instance. Unless you have more than one instance of SQL server running you would best un-install the software and install it as the default instance. This just makes configurations so much easier.



          If you have SSMS (Sql Server Management Studio) installed on your webserver then open and type select @@servername this gives the name of your actual instance.



          You can also see the name in the service, I have a default instance, hence you see no name



          -s swich defining the instance



          Please make sure you know the performance and size limitations of SQL server express before you deploy this too production.



          Have you had a look at SQL Server configuration manager (you may need to install it)



          Protocols



          You need to make sure that if you're not using TCP but DMA or Pipes to use the proper connection string; have you considered:



          \<computer_name>pipeMSSQL$<instance_name>


          Have a look at this URL.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 21 at 22:47









          halfer

          14.7k759116




          14.7k759116










          answered Apr 15 '18 at 13:08









          Computer Aided Trading SystemsComputer Aided Trading Systems

          810414




          810414












          • @Walter: Follow your advice, I checked mine settings are :Sharedmemory: Enabled, Named Pipes: Disabled, TCP/IP : Disabled. I have only one Installed which is SQL2017Express. But I still can not do the CRUD with WebApi. The connectionString is correct.

            – MilkBottle
            Apr 15 '18 at 13:43











          • Can you log the error to a log file? What you do is in your ContactsController constructor you add a parameter ILogger<ContactsController > logger and save it as a class fiel. Then wrap the execution in a try catch and log like this catch (Exception e) _logger.LogError( e) the error, you will see the error on disk after you update your webconfig

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:27












          • you need to go to the webserver and look at where you published the app there will be a web.config file navigate to <aspNetCore> element in webconfig and set stdoutLogEnabled="true" stdoutLogFile="D:InetpublogWebAppName" where webname is any name you like the directory should exist and should not be available to the public as hacjers that cause errors will read it to gain infrmation on the possible attack vectors

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:34











          • @Walter: I have the web.config file in the Deployment Folder in C-drive. The Website in WebServer also has a web.config in AsNetCoreModule. Can I change the one in C-drive and Publish? Which One I Should change? Just set stdoutLogEnabled = true, while stdoutLogFile=".logsstdout" remain the same.

            – MilkBottle
            Apr 16 '18 at 13:26











          • @Walter I can get the log file after implemented the ILogger without change the stdoutLogEnabled = true. I dont change anything in web.config. My Error is 502.3 Bad Gateway. How to fix this problem? This error is captured by PostMan which used to test Api.

            – MilkBottle
            Apr 16 '18 at 13:39


















          • @Walter: Follow your advice, I checked mine settings are :Sharedmemory: Enabled, Named Pipes: Disabled, TCP/IP : Disabled. I have only one Installed which is SQL2017Express. But I still can not do the CRUD with WebApi. The connectionString is correct.

            – MilkBottle
            Apr 15 '18 at 13:43











          • Can you log the error to a log file? What you do is in your ContactsController constructor you add a parameter ILogger<ContactsController > logger and save it as a class fiel. Then wrap the execution in a try catch and log like this catch (Exception e) _logger.LogError( e) the error, you will see the error on disk after you update your webconfig

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:27












          • you need to go to the webserver and look at where you published the app there will be a web.config file navigate to <aspNetCore> element in webconfig and set stdoutLogEnabled="true" stdoutLogFile="D:InetpublogWebAppName" where webname is any name you like the directory should exist and should not be available to the public as hacjers that cause errors will read it to gain infrmation on the possible attack vectors

            – Computer Aided Trading Systems
            Apr 16 '18 at 12:34











          • @Walter: I have the web.config file in the Deployment Folder in C-drive. The Website in WebServer also has a web.config in AsNetCoreModule. Can I change the one in C-drive and Publish? Which One I Should change? Just set stdoutLogEnabled = true, while stdoutLogFile=".logsstdout" remain the same.

            – MilkBottle
            Apr 16 '18 at 13:26











          • @Walter I can get the log file after implemented the ILogger without change the stdoutLogEnabled = true. I dont change anything in web.config. My Error is 502.3 Bad Gateway. How to fix this problem? This error is captured by PostMan which used to test Api.

            – MilkBottle
            Apr 16 '18 at 13:39

















          @Walter: Follow your advice, I checked mine settings are :Sharedmemory: Enabled, Named Pipes: Disabled, TCP/IP : Disabled. I have only one Installed which is SQL2017Express. But I still can not do the CRUD with WebApi. The connectionString is correct.

          – MilkBottle
          Apr 15 '18 at 13:43





          @Walter: Follow your advice, I checked mine settings are :Sharedmemory: Enabled, Named Pipes: Disabled, TCP/IP : Disabled. I have only one Installed which is SQL2017Express. But I still can not do the CRUD with WebApi. The connectionString is correct.

          – MilkBottle
          Apr 15 '18 at 13:43













          Can you log the error to a log file? What you do is in your ContactsController constructor you add a parameter ILogger<ContactsController > logger and save it as a class fiel. Then wrap the execution in a try catch and log like this catch (Exception e) _logger.LogError( e) the error, you will see the error on disk after you update your webconfig

          – Computer Aided Trading Systems
          Apr 16 '18 at 12:27






          Can you log the error to a log file? What you do is in your ContactsController constructor you add a parameter ILogger<ContactsController > logger and save it as a class fiel. Then wrap the execution in a try catch and log like this catch (Exception e) _logger.LogError( e) the error, you will see the error on disk after you update your webconfig

          – Computer Aided Trading Systems
          Apr 16 '18 at 12:27














          you need to go to the webserver and look at where you published the app there will be a web.config file navigate to <aspNetCore> element in webconfig and set stdoutLogEnabled="true" stdoutLogFile="D:InetpublogWebAppName" where webname is any name you like the directory should exist and should not be available to the public as hacjers that cause errors will read it to gain infrmation on the possible attack vectors

          – Computer Aided Trading Systems
          Apr 16 '18 at 12:34





          you need to go to the webserver and look at where you published the app there will be a web.config file navigate to <aspNetCore> element in webconfig and set stdoutLogEnabled="true" stdoutLogFile="D:InetpublogWebAppName" where webname is any name you like the directory should exist and should not be available to the public as hacjers that cause errors will read it to gain infrmation on the possible attack vectors

          – Computer Aided Trading Systems
          Apr 16 '18 at 12:34













          @Walter: I have the web.config file in the Deployment Folder in C-drive. The Website in WebServer also has a web.config in AsNetCoreModule. Can I change the one in C-drive and Publish? Which One I Should change? Just set stdoutLogEnabled = true, while stdoutLogFile=".logsstdout" remain the same.

          – MilkBottle
          Apr 16 '18 at 13:26





          @Walter: I have the web.config file in the Deployment Folder in C-drive. The Website in WebServer also has a web.config in AsNetCoreModule. Can I change the one in C-drive and Publish? Which One I Should change? Just set stdoutLogEnabled = true, while stdoutLogFile=".logsstdout" remain the same.

          – MilkBottle
          Apr 16 '18 at 13:26













          @Walter I can get the log file after implemented the ILogger without change the stdoutLogEnabled = true. I dont change anything in web.config. My Error is 502.3 Bad Gateway. How to fix this problem? This error is captured by PostMan which used to test Api.

          – MilkBottle
          Apr 16 '18 at 13:39






          @Walter I can get the log file after implemented the ILogger without change the stdoutLogEnabled = true. I dont change anything in web.config. My Error is 502.3 Bad Gateway. How to fix this problem? This error is captured by PostMan which used to test Api.

          – MilkBottle
          Apr 16 '18 at 13:39




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49842044%2fdeployed-aspnet-webapi-to-iis-ok-but-return-500-internal-server-error-when-crud%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현