Lynda - 启动并运行ASP.NET somee.com上传错误

时间:2015-10-10 17:18:04

标签: c# asp.net-mvc somee

在仔细观察上面引用的指南(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>    

1 个答案:

答案 0 :(得分: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"

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