ConnectionString Error webconfig asp.net - asp.net

I have configured IIS 6.0 on Windows Server 2003, run ASP and HTML well, I have configured a FTP site to update the asp.net via Visual Studio 2010, VStudio makes the publication fine creating these files in the website folder:
Web.config
Site.Master
Site1.Master
Global.asax
Default.aspx
About.aspx
Styles
Scripts
bin
Account
When I try to run default.aspx I have this error:
Message Error of Analyser: Section not recognized : 'connectionStrings'
Line 9:
Line 10: <configuration>
Line 11: <connectionStrings>
Line 12: <add name="ApplicationServices"
Line 13: connectionString="data source= 192.168.1.2; ;Initial Catalog =ifdcontroladoria3;uid =sa;pwd = admin2012"
this is the code of webconfig
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="Data Source=192.168.1.2 ;Initial Catalog =ifdcontrol;uid =sa;pwd = evita"
providerName="System.Data.SqlClient" />
</connectionStrings>
The server 192.168.1.2 or MAQ001 is on the same computer of the IIS 6.0, what I'm doing wrong?

<connectionStrings>
<add name="ConnectionString" providerName="MySql.Data.MySqlClient"
connectionString="Data Source=127.0.0.1; port=3306; Initial Catalog=*DbName*;
uid=root; pwd=*password*;"/>
</connectionStrings>

Make sure that you have set ASP.NET version to 2.0 or higher for your application pool. Looks like you are having this problem - http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/f3df53fe-666b-4a98-92d2-d6e4ba52552a/.

Related

ASP.NET Administration Tool error

I created a blank DB using SQL Server Management Studio. Ran the aspnet_regsql command to add the necessary tables into the DB. Opened a new Website in VS and added below pieces of code to web.config.
1.
<appSettings> <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" /></appSettings>
2.
<authentication mode="Forms" />
<authorization >
<deny users="?"/>
</authorization>
3.
<connectionStrings><remove name="LocalSqlServer"/><add name="LocalSqlServer" connectionString="Data Source=PC\SQLEXPRESS; Initial Catalog=SiteAdminDB; Integrated Security=True" providerName="System.Data.SqlClient"/></connectionStrings>
I ran this line in cmd: "C:\Program Files\IIS Express\iisexpress.exe" /path:c:\windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:"/asp.netwebadminfiles" /port:8089 /clr:4.0 /ntlm
And typed http://localhost:8089/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\Forms authentication\&applicationUrl=/ in address bar
But I am getting a localhost refused to connect error.
What could be the problem?
Thanks in advance!

How to create database with .sql file in visual studio 2010

I downloaded a asp.net webform application off the internet and it included a .sql file to create the database and tables. I'm new to asp.net/visual studio and kind of stuck with this for days now. Need help.
here's the content of the web.config
<configuration>
<connectionStrings>
<add name="MyConsString" connectionString="Data Source=localhost\SQLEXPRESS; Initial Catalog=myslideshow; Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime executionTimeout="240" maxRequestLength="10240000" />
</system.web>
Open the file with .sql extension in visual studio
Right Click
Execute script
Open the SQL file
use CTRL-SHIFT-E

asp site will not work when uploading to web server?

<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="rde_410978ConnectionString" connectionString="Data Source=SQL2008.net.dcs.hull.ac.uk;Initial Catalog=rde_410978;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
</configuration>
Here is my config file. I'm publishing it to the server by going to build > publish website.
None of the errors are due to the server as the university has set it up and it's working correctly for other people.
the error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:
Line 16:
Line 17: <system.web>
Line 18: <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
Line 19:
Line 20: <authentication mode="Forms">
Source File: C:\RDEUsers\NET\410978\web.config Line: 18
Did you check IIS?
Sometimes IIS is set to a different framework.
http://technet.microsoft.com/en-us/library/cc754523(v=ws.10).aspx
Here is a similar problem and solution:
http://forums.asp.net/t/1491204.aspx/1
I think its because of the .net version of the Deployment Environment, which I presume is not 4.0.
Check it up with others if they have the same target Framework listed i.e. 4.0.

Can't figure out web.debug.config vs. web.config substituation in VS2010

Can someone point me to what am I doing wrong here?
I'm trying to set up an ASP.NET web app project to compile with two versions of web.config file for Release and Debug builds. So for simplicity sake, here's my web.config:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="WhyMicrosoftSucksSoMuch" connectionString="" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
And then I do the following in web.debug.config:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="WhyMicrosoftSucksSoMuch"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename='C:\FilePath\Database1.mdf';User Instance=true"
providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(connectionString)" />
</connectionStrings>
</configuration>
If I publish it under Debug configuration the resulting web.config looks good, but when I try to run my project from VS2010 also under Debug configuration I get an error when my logic attempts to access database:
The ConnectionString property has not been initialized.
So what's the trick here?
PS. And please don't point me to this document. I tried reading it several times but I get a headache from so much superfluous information. I guess MS doesn't know what brief is.
When running it under debug mode it doesn't apply any transformations.
It only applies them during publishing. You can put your debug connection string in the main web.config, and add your production connection string to the web.release.config
also, you probably will want to use
xdt:Transform="Replace"

Membership provider name and type for Microsoft WebMatrix's sample Template

What is the membership provider name and type is used in the Microsoft Webmatrix's template site? In the web.config it is not given. When I run it locally, the template works but when I publish, it gives the following error:
Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
Source Error:
Line 239: <providers>
Line 240: <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, ....
Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 240
Any help will be appreciated.
The Database used in the application is SQLCE4.
Web Pages uses the SimpleMembershipProvider which is located in WebMatrix.WebData.
I don't believe there's a default Membership provider that supports SQL Server Compact Edition 4. There is a Membership provider implementation that does out on CodePlex: http://sqlcemembership.codeplex.com/
So, if you're using that already, then ensure that you have a connection string defined in your config file, like so:
<connectionStrings>
<add name="LocalSqlServer"
connectionString="data source=|DataDirectory|\YourDatabaseName.sdf"/>
</connectionStrings>
And your provider specified in your config should define the connectionStringName attribute and reference the connection string's name defined in the <connectionStrings> block, like this:
<providers>
<clear/>
<add name="SqlCeMembershipProvider"
type="ErikEJ.SqlCeMembershipProvider"
connectionStringName="LocalSqlServer"
.... />
</providers>
A config sample is provided with that SQL CE 4 Membership provider on the main project page.

Resources