I am trying to deploy a asp.net mvc site. My hosting service provider provides me dsn database connection for my sql server 2008 database. I changed my web.config to use dsn connection using this modification in web.config.
<appSettings>
<add key="myDSN" value="evdsn"/>
</appSettings>
In my site I have used asp.net membership provider. I have all the tables of membership provider in my own database. when I deploy the site I get the following error:
\
My web.config file is as follows
<?xml version="1.0" encoding="UTF-8"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<!--<configSections>
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah"/>
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah"/>
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah"/>
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah"/>
</sectionGroup>
</configSections>-->
<appSettings>
<add key="myDSN" value="evodsn"/>
</appSettings>
<connectionStrings>
<add name="evocon" connectionString="DSN=myDSN" providerName="System.Data.Odbc" />
</connectionStrings>
<system.net>
<mailSettings>
<smtp>
<network host="smtp.gmail.com" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<httpHandlers>
<!--<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>-->
<add verb="*" path="TinyMCEHandler.aspx" type="Moxiecode.TinyMCE.Web.HttpHandler, Moxiecode.TinyMCE" validate="false" />
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
</httpHandlers>
<httpRuntime requestValidationMode="2.0" />
<!--<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
</httpModules>-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /></assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<globalization uiCulture="en" culture="en-GB" />
<authentication mode="Forms">
<forms loginUrl="~/Account.mvc/index" timeout="2880" protection="All" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="evocon" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.-->
<customErrors mode="Off">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Linq" />
<add namespace="System.Collections.Generic" />
<add namespace="Telerik.Web.Mvc.UI" />
</namespaces>
</pages>
</system.web>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
</modules>
<handlers>
<remove name="MvcHttpHandler" />
<remove name="UrlRoutingHandler" />
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="Default.aspx" />
<add value="Default.asp" />
<add value="Default.php" />
<add value="Default.htm" />
<add value="Default.html" />
<add value="Index.aspx" />
<add value="Index.asp" />
<add value="Index.php" />
<add value="Index.htm" />
<add value="Index.html" />
<add value="parking.htm" />
</files>
</defaultDocument>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<!--<elmah>
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data"/>
</elmah>-->
<location path="App_Data" allowOverride="false">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>
</configuration>
You're specifying in your <membership><provider> node that you want the connectionStringName to be "myconnectionstring", yet you don't specify that connection string anywhere. You've got an AppSetting key, but that isn't being used either. So, yes, you should use the DSN name provided to you, but you've got to put it in the right place, which is the connectionStrings node in your .config file.
Update
This article about connecting to an ODBC database via the SQLDataSourceControl has some helpful info, namely, that your connectionString section could look like this:
<configuration>
<connectionStrings>
<add
name="ODBCDataConnectionString"
connectionString="Driver=ODBCDriver;server=ODBCServer;"
providerName="System.Data.Odbc"
/>
</connectionStrings>
</configuration>
...so, perhaps instead of using the DSN designation, you could use the "server" attribute of the connectionString and then just use their dsn name there?
What the error message is saying is that in the config file where you specify you'd like to use the AspNetSqlMembershipProvider provider, you are not specifying a valid connection string, which must be defined in a connectionStrings section of your config file.
Try using this connection string:
System DSN
DSN=myDsn;Uid=myUsername;Pwd=;
File DSN
FILEDSN=c:\myDsnFile.dsn;Uid=myUsername;Pwd=;
From: http://www.connectionstrings.com/dsn
Related
I am trying to login for one, and it doesnt let me. Im quite sure it has to do with the web.config file. It stopped working roughly around the same time i used the administration tool to assign roles to (users and staff). Now after i click security on the website administration tool homepage it gives me an error that i cannot connect ot my sql database. I dont understand. I just want to be able to allow users to log in and be redirected to a page i want and staff the same (also having full access to the site while users only to one page that i insist upon). Heres me web.config:
<?xml version="1.0"?>
<!--
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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</appSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebApplication4-20140921152333;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebApplication4-20140921152333.mdf" providerName="System.Data.SqlClient"/>
<add name="PizzaConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\PizzaOrders.mdf;Integrated Security=True;Connect Timeout=30" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
</httpHandlers>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5"/>
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
<controls>
<add tagPrefix="webopt" namespace="Microsoft.AspNet.Web.Optimization.WebForms"
assembly="Microsoft.AspNet.Web.Optimization.WebForms" />
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
</authentication>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
</providers>
</profile>
<membership>
<providers>
<add connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</providers>
</membership>
<roleManager enabled="true">
<providers>
<add connectionStringName="DefaultConnection" applicationName="/" name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
</providers>
</sessionState>
</system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
</entityFramework>
</configuration>
Change the connection string "DefaultConnection" to connect to an instance of SQL Server.
I make a website with asp.net and it works fine. but sometimes it kick users out of their account with out any reason. I mention in my web config for session and web form time out. but it happen again.
and also my data for the sessions are not too much.for example a word!(journal x).
can any body help me?... I become confused!
here is my web config:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=session;timeout=5;" />
</appSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
<system.net>
<mailSettings>
<smtp from="waag#waag.ir">
<network host="mail.waag.ir" port="25" userName="*****" password="*****"/>
</smtp>
</mailSettings>
</system.net>
<connectionStrings>
<!--<add name="dbconn" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>-->
<add name="dbconn" connectionString="Password=****;Persist Security Info=True;User ID=****;Initial Catalog=esfahanhost_****;Data Source=174.142.4.132" providerName="System.Data.SqlClient" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Password=****;Persist Security Info=True;User ID=****;Initial Catalog=esfahanhost_****;Data Source=174.142.4.132" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
</httpHandlers>
<membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="dbconn"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<sessionState mode="InProc" timeout="30"/>
<roleManager enabled="true"/>
<authentication mode="Forms">
<forms timeout="30" slidingExpiration="true" name="AC7.ASPXAUTH" />
</authentication>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<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>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" enableEventValidation="false" viewStateEncryptionMode="Never" enableViewStateMac="false">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
</system.web>
</configuration>
The login information's are stored on one cookie, and if you do not have setup the domain on the web.config for the cookie and you move from eg www.domain.com to domain.com the cookie is not working and may log out.
So set the domain on your form tag as (do not place the www):
<authentication mode="Forms">
<forms domain="yoursitename.com" timeout="30" slidingExpiration="true" name="AC7.ASPXAUTH" />
</authentication>
also set the domain on the roleManager tag and on cookie tag.
More to read about:
Can some hacker steal the cookie from a user and login with that name on a web site?
Multiple applications using same login database logging each other out
I have an ASP.NET 4 site. I'v set timeout to 100 minutes in authentication in web.Config, but when users are working with site suddenly the site prompts to log in even after 3 minutes. The below code is my web.Config file
<?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>
<appSettings>
<add key="ImageMaxFileLengh" value="500" />
</appSettings>
<system.web>
<pages enableViewStateMac="false"></pages>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms defaultUrl="~/Default.aspx" loginUrl="~/Account/Login.aspx" timeout="100" name="HajLogin" slidingExpiration="true" />
</authentication>
<!--<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>-->
<httpHandlers>
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
</httpHandlers>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
</handlers>
</system.webServer>
</configuration>
Make sure you are not creating a FormsAuthenticationTicket within your code. This would override the timeout value you have configured in your web.config. if you are doing something like this in your code, it could be the reason of why it is not working:
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket
(
...
DateTime.Now, // issueDate
DateTime.Now.AddMinutes(30), // expiration
...
);
In case you are not doing the above, take a look at your SessionTimeout. Try increasing it as well.
Regards.
Please don't confuse the timeout to authenticate with the timeout for your session.
You're giving your form 1000 to timeout when seeking authentication. Once it authenticates, you are not looking at this variable for the authenticated session to expire.
Here are some good links describing the difference:
Link 1
Link 2 (Stack Overflow)
Here is a good link describing setting the session timeout in forms authentication:
Link 3
The Timeout property in the Forms tag specifies the amount of minutes the persistent cookie is valid when the remember me checkbox is checked.
Please i have been seeing this error:
The connection name 'SQL' was not found in the applications
configuration or the connection string is empty. Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.
I know for a fact that the connection name "SQL" exists and it works properly on my local machine.
I started seeing this error after i fixed this other error on my deployment server:
Compiler Error Message: BC31007: Unable to open module file
'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
by setting up the access rights as suggested here
Please i would appreciate any help on this.
thanks!
Deployment Environment : Windows Server 2003, .net 4.0
Development Environment: Widows 7, .net 4.0
Please note: The deployed application has been working perfectly well on site, for over 3 months up till last Friday evening.
The client claims nothing on the server or in their environment has changed.
My Web Config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="LoginMode" value="2" />
<add key="CustomeModules" value="True" />
<add key="TopCallersRefeshInterval" value="600" />
<add key="OperatorAccountName" value="" />
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=C:\TempImageFiles\;"/>
</appSettings>
<connectionStrings>
<add name="SQL" connectionString="server=.\SQL2008;database=xxxxxx;uid=xxxxxx;pwd=xxxxxxxxxx;" providerName="System.Data.SqlClient" />
<add name="SQLCustom" connectionString="server=.\SQL2008;database=xxxxxx;uid=xxxxxx;pwd=xxxxxxxxxx;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<compilation debug="true" targetFramework="4.0" explicit="true">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></assemblies>
</compilation>
</system.web>
<system.webServer>
<defaultDocument>
<files>
<remove value="login.aspx" />
<remove value="iisstart.htm" />
<remove value="default.aspx" />
<remove value="index.html" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
<add value="home.aspx" />
</files>
</defaultDocument>
<handlers>
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
</configuration>
But, are you trying to connect to the remote database (i.e., the database on the deployment server) or to a local database.
Maybe somebody has touched the access privileges to the database...
By the way, how did you fixed the original error?
Delete every file(s) with .config format i.e. "web.user.config" but "web.config".
I hope it's help :)
Clear out the temp folder on your server. Recompile, redeploy and see if that fixes it for you. Also:
<connectionStrings>
<clear />
<remove name="SQL"/>
<add name="SQL"
connectionString="server=.\SQL2008;database=xxxxxx;uid=xxxxxx;pwd=xxxxxxxxxx;"
providerName="System.Data.SqlClient" />
.....
</connectionStrings>
If that does not work, try a remote debugging session:
How to: Set Up Remote Debugging
Try adding </clear> under your connection strings in web.config
connectionStrings>
<clear />
<add name="SQL" connectionString="server=.\SQL2008;database=xxxxxx;uid=xxxxxx;pwd=xxxxxxxxxx;" providerName="System.Data.SqlClient" />
.....
</connectionStrings>
Long and short my machine had issues and I had to rebuild it. I reinstalled all my software and put my project backups back on the machine. I have been trying to solve SQL connect issues that I just can't get around.
So after going through many changes and error, I put the working production version back on my machine. When I run it I get the following error:
Parser Error Message: Unknown database 'p10009307_sec'
The Database is known to my SQL Workbench and If I drop a Database connection on a page and configure it I can connect.
The Question is where is it looking that it can't find MySQL? I assume its in the Webconfig, but I don't see anything out of the ordinary that would make localhost diffrent. I made a copy of my webconfig with only the sections that refrence MySQL.
`<connectionStrings>
<remove name="LocalMySqlServer" />
<add name="LocalMySqlServer" connectionString="server=localhost;password=xxxxxxxxxx;
User Id=xxxxxxxxxx;logging=True;database=xxxxxxxxxx_sec" providerName="MySql.Data.MySqlClient" />
<add name="'LocalSqlServer" connectionString="server=localhost;database=xxxxxxxxxx_CUS;
logging=True;password=xxxxxxxxxx;User Id=xxxxxxxxxxER" providerName="MySql.Data.MySqlClient" />
<remove name="LocalSqlServer" />
<add name="p10009307_cusConnectionString" connectionString="server=localhost;
User Id=xxxxxxxxxxER;password=xxxxxxxxxx;database=xxxxxxxxxx_CUS"
providerName="MySql.Data.MySqlClient" />
<add name="p10009307_cusConnectionString2" connectionString="server=localhost;
User Id=xxxxxxxxxER;password=xxxxxxxxxx;database=xxxxxxxxxx_CUS;
SQL SERVER MODE=True" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider" invariant="MySQL.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySQL.Data.MySqlClient.MySqlClientFactory, MySql.Data,
Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<system.web>
<customErrors mode="Off" />
<compilation targetFramework="4.0" debug="true">
<assemblies>
<add assembly="MySql.Data, Version=6.4.4.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d" />
</assemblies>
</compilation>
<authorization>
<allow roles="Admin" />
</authorization>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<clear />
<remove name="MySQLMembershipProvider" />
<add name="MySQLMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider,
MySql.Web, Version=6.4.4.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d" applicationName="/"
description="Membership Provider"
connectionStringName="LocalMySqlServer"
writeExceptionsToEventLog="True"
autogenerateschema="True"
enablePasswordRetrieval="False"
enablePasswordReset="True"
requiresQuestionAndAnswer="False"
requiresUniqueEmail="False" passwordFormat="Clear"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
<profile defaultProvider="MySQLProfileProvider">
<providers>
<clear />
<remove name="MySQLProfileProvider" />
<add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider,
MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
applicationName="/" description="Profile provider"
connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="False"
autogenerateschema="True" />
</providers>
</profile>
<roleManager enabled="true" defaultProvider="MySQLRoleProvider">
<providers>
<clear />
<remove name="MySQLRoleProvider" />
<add applicationName="/" description="Role Provider" connectionStringName="LocalMySqlServer"
writeExceptionsToEventLog="True" autogenerateschema="True" name="MySQLRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.4.4.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d" />
</providers>
</roleManager>
<sessionState mode="Custom" cookieless="true" regenerateExpiredSessionId="true"
customProvider="MySqlSessionStateProvider">
<providers>
<add name="MySqlSessionStateProvider" type="MySql.Web.SessionState.MySqlSessionStateStore,
MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
applicationName="/" description="State Provider" connectionStringName="LocalMySqlServer"
writeExceptionsToEventLog="True" autogenerateschema="True" />
</providers>
</sessionState></system.web>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.3.7.0" newVersion="6.4.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>`
Everything is running local host at this point I have put the DLL's in the bin directory, I don't know what i am missing.
I don't see anything in that config snippet that tells the "MySQL Data Provider" which one out of available conn-strings to use.
There's got to be something in the code that tells it either the conn-string name or the conn-string value. Something like this:
System.Configuration.ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString
Also, your 2nd conn-string has a single-quote character right before its name: 'LocalSqlServer
Perhaps you accidentally added it, and now the conn string cannot be found by the name of "LocalSqlServer" (if that's the one that's the problem, anyway).
If you want to use the MySQL database to store the session, you have to declare this in the Sessionstate of the web.config. Furthermore you have to look into the machine.config file if all the MySQL providers are set.