【问题标题】:Lynda - Up and Running with ASP.NET somee.com upload errorLynda - 使用 ASP.NET somee.com 上传错误启动并运行
【发布时间】:2015-10-10 17:18:04
【问题描述】:

在仔细阅读了上面引用的指南(Lynda Up and Running with ASP.NET)后,我决定将整个解决方案上传到免费主机。

然后我找到了下面的链接:

https://www.youtube.com/watch?v=twNL43W9FRs

一切都很好(从项目的 asp.net mvc 端),直到我使用了使用数据库通信的链接。从那以后我就不能休息了。我收到的唯一消息是“处理您的请求时发生错误错误”。我认为控制器和数据库之间的连接或数据库的设置有问题。

谁能帮帮我?这很令人沮丧,我是 asp.net 的新手。

我的 web.config 如下:

  <?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://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>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-ExploreCalifornia-20140217103953.mdf;Initial Catalog=aspnet-ExploreCalifornia-20140217103953;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <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>
  <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
  </system.web>
  <system.webServer>
    <modules>
      <remove name="FormsAuthenticationModule" />
    </modules>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <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.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>    

【问题讨论】:

  • 使用您提供的信息无法解决您的具体问题,但我非常怀疑您是否可以将(LocalDb) 用于托管服务提供商的数据库。然而,托管服务提供商似乎确实提供了一个免费的 MS SQL 数据库及其免费托管计划;您可能希望从他们那里获取数据库的连接字符串。
  • 您必须查看事件查看器以了解错误详细信息。您有访问权限吗?

标签: c# asp.net-mvc somee


【解决方案1】:

您不能在 Somee 免费订阅中使用 LocalDb。您必须使用他们提供的 SQL 数据库。您需要在控制面板中创建它,然后更改您的连接字符串,使其指向该数据库。像这样的:

    <add name="DefaultConnection" connectionString="Data Source=HERE_GOES_DATABASE;AttachDbFilename=|DataDirectory|\aspnet-ExploreCalifornia-20140217103953.mdf;Initial Catalog=aspnet-ExploreCalifornia-20140217103953;Integrated Security=True"

别担心 - 他们会为您提供正确的连接字符串。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-27
    • 2021-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-17
    相关资源
    最近更新 更多