0

I've been trying to upload my asp.net app on godaddy for going on 3 weeks now. I've already solved all kinds of nightmares with the web.config and I've finally got the damn thing to at least show up. But all pages that call upon database information just crash. I'll go briefly through the steps I used to get it working at the current level in case I missed anything apart from what I suspect is the current problem, which is no database information on the godaddy database.

To upload this monster to godaddy I (using this guide and many many many others http://www.c-sharpcorner.com/article/how-to-host-your-asp-net-mvc-website-on-godaddy-server/)

  1. Uploaded my web app by publishing locally and then zipping, and then uploading to the root directory for the site in godaddy. Then extracted to that directory in file manager (instead of using ftp)

  2. Made sure that my publish (in step 1) published with ALL the dlls and assemblies (bin deployed)

  3. Configured in web.config full trust level, and custom errors mode set off

  4. Created a SQL Server database on goddaddy, and put in the connection string in web.config (I know the string works because I tested the connection in Visual Studio).

  5. In web.config I deleted everything between system.codedom (the website did not even appear before this step).

Here is my web.config if anyone is interested:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <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)\MSSQLLocalDB;AttachDbFilename=&quot;|DataDirectory|\aspnet-BA Portal- 20170128030249.mdf&quot;;Initial Catalog=&quot;aspnet-BA Portal-  20170128030249&quot;;Integrated Security=True"   
             providerName="System.Data.SqlClient" />
        <add name="SampleConnectionString" 
             connectionString="Data Source= (LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Sample.mdf;Integrated  Security=True" 
             providerName="System.Data.SqlClient" />
        <add name="my_banaturalportal" 
             connectionString="Data Source=184.168.194.53;Integrated Security=False;database=my_banaturalportal;User ID=my_banaturalportal_user;Password=*******;Connect Timeout=1500;" />
    </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>
        <customErrors mode="Off" />
        <trust level="Full" />
        <authentication mode="None" />
        <compilation targetFramework="4.5.2" defaultLanguage="c#" />
        <httpRuntime targetFramework="4.5.2" />
        <httpModules> 
            <add name="ApplicationInsightsWebTracking"   type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule,  Microsoft.AI.Web" />
        </httpModules>
    </system.web>
    <system.webServer>
        <modules>
             <remove name="FormsAuthentication" />
             <remove name="ApplicationInsightsWebTracking" />
             <add name="ApplicationInsightsWebTracking" 
                  type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
        </modules>
        <validation validateIntegratedModeConfiguration="false" />
    </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
                    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" 
                                     newVersion="3.0.1.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
                    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" 
                                     newVersion="3.0.1.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
                    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0"  
                                     newVersion="3.0.1.0" />
            </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
  </dependentAssembly>
  <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.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.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="itextsharp" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.5.10.0" newVersion="5.5.10.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="itextsharp.xmlworker" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.5.10.0" newVersion="5.5.10.0" />
          </dependentAssembly>
        </assemblyBinding>
    </runtime>
    <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>
    <system.codedom>
    </system.codedom>
</configuration>
<!--ProjectGuid: {9AFE5866-CFA2-43B2-8122-EC12418E7D63}-->  

Now I've got my web app and it at least shows up, but I can't log in (https://my.banaturalportal.com/). So to try and better understand the problem i uploaded a second version with no authorizations (no login) here (http://testing.banaturalportal.com/) and noticed that every page that call on a database item throws an exception (calling the "forbidden" error page). By the way site has no certificate right now. I don't know if thats a problem.

I never did do anything to put data into the SQL Server database. I assumed it would just somehow work. I guess this was wrong. I guess my first question is, does this throwing an exception when database items get called sound like an error caused because I haven't put my database objects into the godaddy SQL Server (somehow), even though I made sure all the .mdf are still in the App_data folder even in the uploaded manager. And two, if that is the case how do I put these databases into godaddy? How do I put my .mdf files that I can access just fine locally in my App_data, into godaddy so that my asp.net website can use it.

I have researched a lot and I can't really figure out what the steps are. All I was able to figure out is that I need SSMS (which I have downloaded), and maybe my SQL for Visual Studio (which I have also downloaded).

I'd be perfectly happy to be pointed in the right direction too. I know godaddy is not a popular topic, but I'd appreciate any help because I've been doing this everyday for 3 weeks and I am just like, very sad at this point.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Tyler S. Loeper
  • 816
  • 11
  • 22
  • does your godaddy account support LocalDB? A quick google suggests they don't. http://stackoverflow.com/questions/38555321/does-godaddy-support-database-connections-to-app-data-mdf-databases . You might have to export your DB as a script, or convert it to a .bak and then import it into the standard SQL Server database that you get with the account. Apart from doing that and changing the connection string, all your actual SQL code etc ought to work the same. – ADyson Apr 08 '17 at 04:46
  • Thank you. This is a good starting point for me. I will try to export my db as a script. – Tyler S. Loeper Apr 08 '17 at 07:13

1 Answers1

1

I think ADyson right, try to import your localDB into sql server. this answer could be helpful for this: How to transfer ASP.NET MVC Database from LocalDb to SQL Server?

Community
  • 1
  • 1
Alexander V.
  • 1,518
  • 14
  • 14
  • Thank you, this link led me to a feature called schema compare that is already supported within visual studio, which allowed me to export my database schemas etc to the sql server on godaddy. Now everything works good. Thanks – Tyler S. Loeper Apr 10 '17 at 07:11