Wednesday, April 24, 2019

Issue retrieving data after adding a table to a DBContext

I needed to add a table for a database that I have already created. I ran into some issues and I share them problem here: https://www.reddit.com/r/dotnet/comments/bftexf/adding_a_table_to_a_database_and_then_updating/

I was able to get table added to my context file. Unfortunately, I'm unable to retrieve the data that is in the table. This is part of an asp.net core application.

These are the error messages that I'm receiving:

In the browser:

HTTP Error 502.3 - Bad Gateway The specified CGI application encountered an error and the server terminated the process.

In Visual Studio:

Microsoft.EntityFrameworkCore.Database.Command:Information: Executed DbCommand (78ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT [z].[ZipCode], [z].[City], [z].[County], [z].[Grecian], [z].[Grid], [z].[Inground], [z].[Kayak], [z].[Metric], [z].[Radiant], [z].[ST], [z].[Timestamp] FROM [ZipGrids] AS [z] Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2019-04-24T07:11:15.1890185Z","tags":{"ai.cloud.roleInstance":"DESKTOP-FKE1QD2","ai.application.ver":"1.0.0.0","ai.internal.sdkVersion":"aspnet5c:2.1.1","ai.location.ip":"127.0.0.1","ai.operation.id":"bcd8c22c-4b67a51b37c2f790","ai.internal.nodeName":"DESKTOP-FKE1QD2","ai.operation.name":"GET ZipGrids/Index","ai.operation.parentId":"|bcd8c22c-4b67a51b37c2f790."},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Executed DbCommand (78ms) [Parameters=[], CommandType='Text', CommandTimeout='30']\r\nSELECT [z].[ZipCode], [z].[City], [z].[County], [z].[Grecian], [z].[Grid], [z].[Inground], [z].[Kayak], [z].[Metric], [z].[Radiant], [z].[ST], [z].[Timestamp]\r\nFROM [ZipGrids] AS [z]","severityLevel":"Information","properties":{"elapsed":"78","AspNetCoreEnvironment":"Development","commandText":"SELECT [z].[ZipCode], [z].[City], [z].[County], [z].[Grecian], [z].[Grid], [z].[Inground], [z].[Kayak], [z].[Metric], [z].[Radiant], [z].[ST], [z].[Timestamp]\r\nFROM [ZipGrids] AS [z]","commandTimeout":"30","CategoryName":"Microsoft.EntityFrameworkCore.Database.Command","{OriginalFormat}":"Executed DbCommand ({elapsed}ms) [Parameters=[{parameters}], CommandType='{commandType}', CommandTimeout='{commandTimeout}']{newLine}{commandText}","commandType":"Text","DeveloperMode":"true"}}}} 'dotnet.exe' (CoreCLR: clrhost): Loaded 'zlap2yrx.cve'. Cannot find or open the PDB file. Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor:Information: Executing ViewResult, running view at path /Views/ZipGrids/Index.cshtml. Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2019-04-24T07:11:16.9472852Z","tags":{"ai.cloud.roleInstance":"DESKTOP-FKE1QD2","ai.application.ver":"1.0.0.0","ai.internal.sdkVersion":"aspnet5c:2.1.1","ai.location.ip":"127.0.0.1","ai.operation.id":"bcd8c22c-4b67a51b37c2f790","ai.internal.nodeName":"DESKTOP-FKE1QD2","ai.operation.name":"GET ZipGrids/Index","ai.operation.parentId":"|bcd8c22c-4b67a51b37c2f790."},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Executing ViewResult, running view at path /Views/ZipGrids/Index.cshtml.","severityLevel":"Information","properties":{"AspNetCoreEnvironment":"Development","CategoryName":"Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor","{OriginalFormat}":"Executing ViewResult, running view at path {Path}.","DeveloperMode":"true","Path":"/Views/ZipGrids/Index.cshtml"}}}} The thread 0x5b4c has exited with code 0 (0x0). The thread 0x5f80 has exited with code 0 (0x0). The thread 0x197c has exited with code 0 (0x0). The thread 0x545c has exited with code 0 (0x0). The thread 0x4c88 has exited with code 0 (0x0). The thread 0x6b4 has exited with code 0 (0x0). The thread 0xf44 has exited with code 0 (0x0). Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action KPM.Azure.Controllers.ZipGridsController.Index (KPM.Azure) in 223738.0207ms Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2019-04-24T07:14:56.5761548Z","tags":{"ai.cloud.roleInstance":"DESKTOP-FKE1QD2","ai.application.ver":"1.0.0.0","ai.internal.sdkVersion":"aspnet5c:2.1.1","ai.location.ip":"127.0.0.1","ai.operation.id":"bcd8c22c-4b67a51b37c2f790","ai.internal.nodeName":"DESKTOP-FKE1QD2","ai.operation.name":"GET ZipGrids/Index","ai.operation.parentId":"|bcd8c22c-4b67a51b37c2f790."},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Executed action KPM.Azure.Controllers.ZipGridsController.Index (KPM.Azure) in 223738.0207ms","severityLevel":"Information","properties":{"AspNetCoreEnvironment":"Development","ElapsedMilliseconds":"223738.0207","CategoryName":"Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker","{OriginalFormat}":"Executed action {ActionName} in {ElapsedMilliseconds}ms","ActionName":"KPM.Azure.Controllers.ZipGridsController.Index (KPM.Azure)","DeveloperMode":"true"}}}} Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 223815.0902ms 200 text/html; charset=utf-8 Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2019-04-24T07:14:56.6085625Z","tags":{"ai.cloud.roleInstance":"DESKTOP-FKE1QD2","ai.application.ver":"1.0.0.0","ai.internal.sdkVersion":"aspnet5c:2.1.1","ai.location.ip":"127.0.0.1","ai.operation.id":"bcd8c22c-4b67a51b37c2f790","ai.internal.nodeName":"DESKTOP-FKE1QD2","ai.operation.name":"GET ZipGrids/Index","ai.operation.parentId":"|bcd8c22c-4b67a51b37c2f790."},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Request finished in 223815.0902ms 200 text/html; charset=utf-8","severityLevel":"Information","properties":{"AspNetCoreEnvironment":"Development","StatusCode":"200","ElapsedMilliseconds":"223815.0902","CategoryName":"Microsoft.AspNetCore.Hosting.Internal.WebHost","ContentType":"text/html; charset=utf-8","DeveloperMode":"true"}}}} Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Request","time":"2019-04-24T07:11:12.7900825Z","tags":{"ai.operation.id":"bcd8c22c-4b67a51b37c2f790","ai.operation.name":"GET ZipGrids/Index","ai.internal.sdkVersion":"aspnet5c:2.1.1","ai.internal.nodeName":"DESKTOP-FKE1QD2","ai.location.ip":"127.0.0.1","ai.cloud.roleInstance":"DESKTOP-FKE1QD2","ai.application.ver":"1.0.0.0"},"data":{"baseType":"RequestData","baseData":{"ver":2,"id":"|bcd8c22c-4b67a51b37c2f790.","name":"GET ZipGrids/Index","duration":"00:03:43.8221146","success":true,"responseCode":"200","url":"https://localhost:44330/ZipGrids","properties":{"AspNetCoreEnvironment":"Development","httpMethod":"GET","DeveloperMode":"true"}}}} The thread 0x5b10 has exited with code 0 (0x0). The thread 0x37b4 has exited with code 0 (0x0).

I walked through the code in visual studio and I didn't have any errors.

Can anyone point me in the right direction?

Issue retrieving data after adding a table to a DBContext Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team