public class Factry
{
public string Miner_address { get; set; }
public string PledgeFactory { get; set; }
}
[HttpGet]
public ActionResult<Factry> GetFactory(string userid, string pass)
{
DataTable dt;
Factry Umm = new Factry();
if (checkname(userid, pass))
{
if (connopen())
{
string ls_string = "select pool_address_gf,PledgeFactory from configtb ";
try
{
dt = DataSet_out_(ls_string);
}
catch
{
Umm.Miner_address = null;
Umm.PledgeFactory = null;
return Umm;
}
if (!Convert.IsDBNull(dt))
{
if (dt.Rows.Count != 0)
{
if (dt.Rows[0][0] == null)
{
Umm.Miner_address = null;
}
else
{
if ( dt.Rows[0][0].ToString() == "")
{
Umm.Miner_address = null;
}
else
{
Umm.Miner_address = dt.Rows[0][0].ToString();
}
}
if (dt.Rows[0][1] == null)
{
Umm.PledgeFactory = null;
}
else
{
if ( dt.Rows[0][1].ToString() == "")
{
Umm.PledgeFactory = null;
}
else
{
Umm.PledgeFactory = dt.Rows[0][1].ToString();
}
}
}
else
{
Umm.Miner_address = null;
Umm.PledgeFactory = null;
}
}
else
{
Umm.Miner_address = null;
Umm.PledgeFactory = null;
}
}
else
{
Umm.Miner_address = null;
Umm.PledgeFactory = null;
}
}
else
{
Umm.Miner_address = null;
Umm.PledgeFactory = null;
}
return Umm;
}
今天控制臺回傳一個錯誤如下:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.NullReferenceException: Object reference not set to an instance of an object.
at smartx.Controllers.ValuesController.GetFactory(String userid, String pass)
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/275317.html
標籤:C#
下一篇:vs.net 有沒有插件可以在單步或者其他方式除錯的時候顯示代碼行的執行時間? 另外能手工控制GC回識訓制么?
