Issues when installing AspxCommerce onto GoDaddy Servers - c#

I have been up all night trying to figure it out and when I try and install AspxCommerce onto my GoDaddy server. I have ran across multiple issues when trying to install this, all of the answers have been found after long research although for This last issue I am getting Configuration Error saying that I do not have any connection to 'SageFrameConnectionString'. Does anybody have any thoughts on how I should go about doing this including the necessary steps to get there?
PS: Everything works great when installed locally..
web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<roleManager enabled="true" defaultProvider="SageFrameSqlRoleProvider">
<providers>
<clear />
<add connectionStringName="SageFrameConnectionString" applicationName="SageFrame" name="SageFrameSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add applicationName="SageFrame" name="SageFrameWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
</system.web>
</configuration>
connectionstring.config:
<?xml version="1.0"?>
<connectionStrings>
<clear />
<add name="SageFrameConnectionString" connectionString="Data Source=;Initial Catalog=;Integrated Security=False;Persist Security Info=False;User ID=;Password=;Connect Timeout=120" providerName="System.Data.SqlClient" />
</connectionStrings>

Actually it is not a AspxCommerce problem. It's a GoDaddy server problem.
GoDaddy doesnt allow roles unless you use LocalSqlServer as your membership provider connection string.For GoDaddy you have couple of change in AspxCommerce .
In connectionstring.config file :
<connectionStrings>
<clear />
<add name="LocalSqlServer" connectionString="Data Source=.;Initial Catalog=YourCatlog;Integrated Security=False;Persist Security Info=False;User ID="ID";Password="PSWD";Connect Timeout=120" providerName="System.Data.SqlClient" />
</connectionStrings>
And In library go to SageFrame.Common\Setting\SystemSetting.cs on Declaration section :
replace
public static string SageFrameConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SageFrameConnectionString"].ToString();
with
public static string SageFrameConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["LocalSqlServer"].ToString();
Note : Don't forget to rebuild library.

Related

Unable to connect to SQL Server database in ASP.NET Web Admin Tool

Like the title says I am trying to make some roles for a site that i am making.
Whenever I enter the security tab the error in the title is displayed.
I have used the aspnet_regsql wizard to configure a database for this purpose. The creation of the database was successful, but i still get the error.
Here is the webconfig so far:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<entityFramework>
<contexts>
<context type="ContosoUniversity.DAL.SchoolContext, ContosoUniversity">
<databaseInitializer type="ContosoUniversity.DAL.SchoolInitializer, ContosoUniversity" />
</context>
</contexts>
<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>
<connectionStrings>
<add name="SchoolContext" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=ContosoUniversity1;Integrated Security=SSPI;" 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.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<add namespace="TESTMVC" />
</namespaces>
</pages>
</system.web.webPages.razor>
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
<system.web>
<compilation>
<assemblies>
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
</configuration>
I know I am probably missing some membership tag in this xml?
Could anyone help me fix the webconfig file?
This connection string is used for a page that displays some stuff from this database. On this save (localdb)\MSSQLLocalDB i have the aspnetdb made by the wizard aspnet_regsql.
<connectionStrings>
<add name="SchoolContext" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=ContosoUniversity1;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>
Base on your comment you are new to ASP.NET Membership. ASP.Net Membership you mentioned is over 10 to 15 years old. Microsoft has replaced it few others in those years.
Here is the history -
ASP.Net Membership Provider (which uses aspnet_regsql to generate tables)
ASP.NET Universal Providers
Simple Membership Provider
ASP.NET Identity (latest one)
Since you are also new to ASP.Net Membership, I personally recommend to use ASP.Net Identity. Here is the free ASP.NET MVC 5 Fundamentals course by Scott Allen
With Integrated Security=SSPI, I believe you are going to connect to SQL server as whatever account the web site is running under, likely an apppool identity account. You should either create a user in SQL and explicitly connect with those credentials, or add the app pool identity to have permissions:
For a local SQL Server (from https://blogs.msdn.microsoft.com/ericparvin/2015/04/14/how-to-add-the-applicationpoolidentity-to-a-sql-server-login/):
Open SQL Server Management Studio (SSMS) and connect to the SQL Server.
Open the Security folder at the server level and not the security folder for the database.
Right click on the logins and select New Login.
For the login, type IIS APPPOOL\AppPoolName and DO NOT CLICK SEARCH and select OK (If a search is executed, it will resolve to an account with ServerName\AppPool Name and SQL will be unable to resolve the account’s SID since it is virtual)
Select the defaults for the account and select OK to close dialog

Working on a project without a connection string

I am trying to publish my website on the intranet server. From websites and suggestion I understood that i had to change the connection string to point to the database in the intranet server. While trying to do that i understand that i do not have a connectionstring in my web.config. Or maybe I am not having something similar to what that has been mentioned in the websites. Should I have added the connection string explicitly before I started working on the project? But my project works fine in my local machine with the local database.
So is it possible that a project can work without a connection string when working with local database or am I missing something really important? Now when I need to publish the project i could add a connection string in the web.Config file? I have a connection string portion commented out in my web.release. Should i uncomment the connection string in web.release or i add a new connection string in web.config.
Web.Config
<configuration>
<configSections>
<section name="entityFramework" requirePermission="false" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</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>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- So many dependent assembly -->
</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>
</configuration>
Web.Release.config
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
<connectionStrings>
<add connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" name="MyDB" xdt:Locator="Match(name)" xdt:Transform="SetAttributes" />
</connectionStrings>
-->
</configuration>
I am using Visual Studio Express 2013 for web. Devloped application is a MVC5 web application. Database used Local DB. But i have copied the database into the intranet server using SSMS.
Update : added config details
Based on comments and answer i have added the following to my web.config
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add
name="TEDALS_Ver01.DAL.TedalsContext"
connectionString="Server=FE0VMC0643; Database=TeDaLSdev; "
providerName="System.Data.SqlClient" />
</connectionStrings>
And this is the connection string that i have in the properties of the database
Data Source=FE0VMC0643;Initial Catalog=TeDaLSdev;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False
So is it possible that a project can work without a connection string when working with local database or am I missing something really important?
If you're using Entity Framework (I don't know about other ORMs) and you don't specify a connection string it will internally create one pointing to LocalDB or SQLExpress by using the full name of your DbContext.
It's explained in Entity Framework > Get Started > Connections and Models:
If you have not done any other configuration in your application, then calling the parameterless constructor on DbContext will cause DbContext to run in Code First mode with a database connection created by convention. […] uses the namespace qualified name of your derived context class […] as the database name and creates a connection string for this database using either SQL Express or LocalDb. If both are installed, SQL Express will be used.
If your database is not following the convention established by Entity Framework, then you either modify your database to have it following the convention or add a connection string for Entity Framework to use.
If your DbContext is
namespace MySolution.MyApplication.Contexts
{
public class MyContext : DbContext
{
[…]
}
}
either you have a database named MySolution.MyApplication.Contexts.MyContext in your (localdb)\MSSQLLocalDB / localhost\SQLExpress instance or add the following connection string to your App.config / Web.config:
<add
name="MySolution.MyApplication.Contexts.MyContext"
connectionString="Server=myServerAddress; Database=myDataBase; User Id=myUsername; Password=myPassword;"
providerName="System.Data.SqlClient" />

Visual Studio 2013 and ASP.NET Web Configuration Tool -Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion

Problem: Visual Studio 2013 and ASP.NET Web Configuration Tool
I wanted to make fast roles etc. I tried enable it using this article: http://blogs.msdn.com/b/webdev/archive/2013/08/19/asp-net-web-configuration-tool-missing-in-visual-studio-2013.aspx?PageIndex=2#comments .
I can enter the configuration tool, I added 2 roles & users but than when I want to log in in my website in VS already I have the following mistake:
In addition, even though my web site is hold in the "C:\Aspnet\ WebSite4-20150614_m10z1" I realize that new app_data folder appeared automatically (second already) with the base aspnetdb - this time in the following path (in "C:\Aspnet"). One level upper.
what I did already:
x IIS Express
iisexpress.exe /path:c:\windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:"/asp.netwebadminfiles" /port:8089 /clr:4.0 /ntlm
information: registration completed
x Developer Command Promopt for VS2013
aspnet_regsql -A all -C "Data Source= WIN-G6HBJHSJ5B3\SQLEXPRESS; Integrated Security=True; User Instance=True" -d "C:\Aspnet\WebSite4-20150614_m10z1\App_Data\AdventureWorksLT2008_Data.mdf"
Attachments:
x web config:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="AdventureWorksLT2008_DataConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\AdventureWorksLT2008_Data.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<roleManager enabled="true" defaultProvider="CustomizedRoleProvider">
<providers>
<add name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"
applicationName="AdventureWorks"
connectionStringName="AdventureWorksLT2008_DataConnectionString"/>
</providers>
</roleManager>
<membership defaultProvider="CustomizedMembershipProvider">
<providers>
<add name="CustomizedMembershipProvider"
type="system.Web.Security.SqlmembershipProvider"
applicationName="AdventureWorks"
connectionStringName="AdventureWorksLT2008_DataConnectionString"/>
</providers>
</membership>
<authentication mode="Forms">
<forms loginUrl="Zaloguj.aspx" />
</authentication>
<authorization>
<allow roles="Administrator"/>
</authorization>
</system.web>
</configuration>
x administration tool
In the "Web Site Administration Tool" in the Application I have emptiness after the mark "/" . This is how it looks "Application: /"
Suspicious:
connection to ASPNETDB & right configuration of aspnet_regsql
check the procedure proper name that you have implemented in code behind this is not same or it can't get the procedure name

(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Trying to access asp.net configuration and get this '(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)'
already tried these solutions: http://forums.asp.net/t/1396682.aspx?Could+not+establish+a+connection+to+the+database+for+asp+net+configuration+
http://forums.iis.net/t/1163032.aspx?
Provider+Management+error+of+asp+net+configaration+in+asp+net
Asp.Net membership via ASP.NET Website Administrator Tool
UPDATE: I took a look in the SQL Server Configuration Manager and selected SQL server Service and it had a error "The remote procedure call failed.[0x800706be]" What I don't get is what caused this, was it the web.config or the sql server itself. To my knowledge the SQL server file is still in one place and that's it, I made a Connection string in VS to check if everything is OK and the server contained all the tables needed and everything was alright so I don't get the catch here.
here is my 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=169433
-->
<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>
<system.web>
<roleManager enabled="true" />
<authentication mode="Forms" />
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
</system.web>
<connectionStrings>
<add name="ConnectionStringTest" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Project.mdf;Integrated Security=True;MultipleActiveResultSets=True;Connect Timeout=30;Application Name=EntityFramework"
providerName="System.Data.SqlClient" />
<add name="ASPNETDB" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ASPNETDB.mdf;Integrated Security=True;MultipleActiveResultSets=True;Connect Timeout=30;Application Name=EntityFramework"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>

How do I use Web.Config transform on my connection strings?

In my current project, I have some connection strings that are valid for local development machines:
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="Data Source=localhost;Initial Catalog=MyDB;Integrated Security=SSPI"
</connectionStrings>
....
</configuration>
How would I use the Web.Config transforms to convert from this expression to one valid for our production server? The production server one would look something like:
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="Data Source=IPAddress,Port;Initial Catalog=SomeOtherDB;User ID=TopSecretUsername;Password=SecurePassword"
</connectionStrings>
....
</configuration>
The syntax isn't obvious to me, and I'm completely failing at grokking the page on it.
This works for me but I too have found it to be a bit flakey at times.
You will need to create another file called Web.Config.Release and fill it with the following:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="local" connectionString="Data Source=IPAddress,Port;Initial Catalog=SomeOtherDB;User ID=TopSecretUsername;Password=SecurePassword"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
<appSettings>
<add key="default_db_connection" value="local" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
</appSettings>
</configuration>
You shouldn't need to create a new file, it should be in the Solution Explorer, expand Web.config, and open Web.Release.config.
Scott Allan has a good video on it here (under Configuration and Deployment > Config Transformations).

Categories

Resources