Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP.net内部服务器错误500.19_Asp.net_Asp.net Mvc - Fatal编程技术网

ASP.net内部服务器错误500.19

ASP.net内部服务器错误500.19,asp.net,asp.net-mvc,Asp.net,Asp.net Mvc,这是一个ASP.NETMVC项目,我试图用ajax查看4个表的数据。首先,我创建新类,然后使用jsonresult,然后在视图中使用ajax [HttpPost] public JsonResult GetallData(int id) { MultipleViewModel model = new MultipleViewModel(); List<InformationSecurityData> iso = db.Informati

这是一个ASP.NETMVC项目,我试图用ajax查看4个表的数据。首先,我创建新类,然后使用jsonresult,然后在视图中使用ajax

[HttpPost]
    public JsonResult GetallData(int id)
    {
        MultipleViewModel model = new MultipleViewModel();
        List<InformationSecurityData> iso = db.InformationSecurityDatas.Where(x => x.Supplier_ID == id).ToList();
        List<SurveyForm> tender = db.SurveyForms.Where(x => x.Supplier_ID == id ).ToList();
        List<ProcurementData> procurement = db.ProcurementDatas.Where(x => x.Supplier_ID == id ).ToList();
        List<Supplier> supp = db.Suppliers.Where(x => x.Supplier_ID == id ).ToList();

        model.Inf_Sec_Dat = iso;
        model.Proc_Dat = procurement;
        model.Tender_Dat = tender;
        model.Supp_dat = supp;
        string json = JsonConvert.SerializeObject(model, 
        Formatting.Indented,
        new JsonSerializerSettings
        {
            ReferenceLoopHandling = ReferenceLoopHandling.Serialize
        });

        return Json(model, JsonRequestBehavior.AllowGet);
    }

在JSON函数上设置一个断点,是否获取id?我认为您的URL是错误的,应该是:

  URL: "/Dashboard/GetallData/",
  data: { id: id },
  cache: false,
  type: "POST",
  success: function (data) {
      alert("success ");
  },
  error: function (reponse) {
      alert("error : " + reponse);
  }

您尝试过哪些解决方案?添加它们,让我们知道您面临的问题。我尝试了这些答案中的大多数,请发布错误堆栈,这将有助于跟踪您的问题缩小问题注释控制器操作中的所有代码,并保留以下代码行MultipleViewModel model=new multiplewiwmodel();返回Json(model,JsonRequestBehavior.AllowGet);然后重试。
内部服务器错误
表示服务器正在引发异常。使用您的浏览器工具(网络选项卡)检查将包含异常详细信息的响应。我在@Mary完成了Qafarinia@ysrsy请用输出/错误编辑您的原始帖子
public class MultipleViewModel
{
    public List<InformationSecurityData> Inf_Sec_Dat { get; set; }
    public List<ProcurementData> Proc_Dat { get; set; }
    public List<SurveyForm> Tender_Dat { get; set; }
    public List<Supplier> Supp_dat { get; set; }

}
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please 
visit
  https://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit 
http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" 
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, 
EntityFramework, Version=6.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <!--
    For a description of web.config changes see 
http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5.2" />
      </system.Web>
  -->
   <system.web>
    <authentication mode="Forms">
      <forms cookieless="UseCookies" loginUrl="~/user/login" 
slidingExpiration="true" />
    </authentication>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
    <httpModules>
      <add name="ApplicationInsightsWebTracking" 
type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, 
Microsoft.AI.Web" />
    </httpModules>
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" 
publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" 
/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" 
publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" 
/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" 
/>
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" 
newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" 
publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" 
/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" 
publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" 
/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" 
publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" 
/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.webServer>
    <httpErrors existingResponse="PassThrough" />
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" 
type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, 
 Microsoft.AI.Web" preCondition="managedHandler" />
    </modules>
  </system.webServer>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
  /system.codedom>
  <entityFramework>
   <defaultConnectionFactory 
type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, 
EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" 
type="System.Data.Entity.SqlServer.SqlProviderServices, 
EntityFramework.SqlServer" />
    </providers>
   </entityFramework>
  <connectionStrings>
        <add name="SupplierEvaluationEntities1" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string='data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=&quot;C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\SupplierEvaluation.mdf&quot;;integrated security=True;multipleactiveresultsets=True;connect timeout=30;application name=EntityFramework'" providerName="System.Data.EntityClient" />
     </connectionStrings>
</configuration>
 System.StackOverflowException
 HResult=0x800703E9
 Message=Exception of type 'System.StackOverflowException' was thrown.
  URL: "/Dashboard/GetallData/",
  data: { id: id },
  cache: false,
  type: "POST",
  success: function (data) {
      alert("success ");
  },
  error: function (reponse) {
      alert("error : " + reponse);
  }