PROBLEMAS COM STRING DE CONEXAO NO WEB.CONFIG

MADUJR 17/10/2009 16:29:05
#325582
Boa Tade.

Estou tentando colocar a string de conexão do meu BD no web.config, mas o seguinte erro me é apresentado:


Erro de Servidor no Aplicativo [ô]/[ô].
--------------------------------------------------------------------------------

Erro de configuração
Descrição: Erro durante o processamento de um arquivo de configuração necessário para o serviço desta solicitação. Examine os detalhes específicos do erro e modifique esse arquivo de configuração apropriadamente.

Mensagem de Erro do Analisador: Seção de configuração não reconhecida add.

Erro de Origem:


Linha 15: </configSections>
Linha 16: <appSettings/>
Linha 17: <add name=[Ô]Default[Ô] connectionString=[Ô]Data Source=.\SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô] providerName=[Ô]System.Data.SqlClient[Ô]/>
Linha 18: <connectionStrings/>
Linha 19: <system.web>


Arquivo de Origem: C:\Users\madureira\Documents\Visual Studio 2008\Projects\Teste\Teste\web.config Linha: 17



Alguem sabe o que pode estar acontecendo ?

Abaixo o web.config:


<?xml version=[Ô]1.0[Ô]?>
<configuration>
<configSections>
<sectionGroup name=[Ô]system.web.extensions[Ô] type=[Ô]System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]>
<sectionGroup name=[Ô]scripting[Ô] type=[Ô]System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]>
<section name=[Ô]scriptResourceHandler[Ô] type=[Ô]System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô] requirePermission=[Ô]false[Ô] allowDefinition=[Ô]MachineToApplication[Ô]/>
<sectionGroup name=[Ô]webServices[Ô] type=[Ô]System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]>
<section name=[Ô]jsonSerialization[Ô] type=[Ô]System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô] requirePermission=[Ô]false[Ô] allowDefinition=[Ô]Everywhere[Ô]/>
<section name=[Ô]profileService[Ô] type=[Ô]System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô] requirePermission=[Ô]false[Ô] allowDefinition=[Ô]MachineToApplication[Ô]/>
<section name=[Ô]authenticationService[Ô] type=[Ô]System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô] requirePermission=[Ô]false[Ô] allowDefinition=[Ô]MachineToApplication[Ô]/>
<section name=[Ô]roleService[Ô] type=[Ô]System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô] requirePermission=[Ô]false[Ô] allowDefinition=[Ô]MachineToApplication[Ô]/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings/>
<add name=[Ô]Default[Ô] connectionString=[Ô]Data Source=.\SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô] providerName=[Ô]System.Data.SqlClient[Ô]/>
<connectionStrings/>
<system.web>
<compilation debug=[Ô]true[Ô]>
<assemblies>
<add assembly=[Ô]System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089[Ô]/>
<add assembly=[Ô]System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089[Ô]/>
<add assembly=[Ô]System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
<add assembly=[Ô]System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089[Ô]/>
</assemblies>
</compilation>
<authentication mode=[Ô]Windows[Ô]/>
<pages>
<controls>
<add tagPrefix=[Ô]asp[Ô] namespace=[Ô]System.Web.UI[Ô] assembly=[Ô]System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
<add tagPrefix=[Ô]asp[Ô] namespace=[Ô]System.Web.UI.WebControls[Ô] assembly=[Ô]System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
</controls>
</pages>
<httpHandlers>
<remove verb=[Ô]*[Ô] path=[Ô]*.asmx[Ô]/>
<add verb=[Ô]*[Ô] path=[Ô]*.asmx[Ô] validate=[Ô]false[Ô] type=[Ô]System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
<add verb=[Ô]*[Ô] path=[Ô]*_AppService.axd[Ô] validate=[Ô]false[Ô] type=[Ô]System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
<add verb=[Ô]GET,HEAD[Ô] path=[Ô]ScriptResource.axd[Ô] type=[Ô]System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô] validate=[Ô]false[Ô]/>
</httpHandlers>
<httpModules>
<add name=[Ô]ScriptModule[Ô] type=[Ô]System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language=[Ô]c#;cs;csharp[Ô] extension=[Ô].cs[Ô] warningLevel=[Ô]4[Ô] type=[Ô]Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089[Ô]>
<providerOption name=[Ô]CompilerVersion[Ô] value=[Ô]v3.5[Ô]/>
<providerOption name=[Ô]WarnAsError[Ô] value=[Ô]false[Ô]/>
</compiler>
</compilers>
</system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration=[Ô]false[Ô]/>
<modules>
<remove name=[Ô]ScriptModule[Ô]/>
<add name=[Ô]ScriptModule[Ô] preCondition=[Ô]managedHandler[Ô] type=[Ô]System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
</modules>
<handlers>
<remove name=[Ô]WebServiceHandlerFactory-Integrated[Ô]/>
<remove name=[Ô]ScriptHandlerFactory[Ô]/>
<remove name=[Ô]ScriptHandlerFactoryAppServices[Ô]/>
<remove name=[Ô]ScriptResource[Ô]/>
<add name=[Ô]ScriptHandlerFactory[Ô] verb=[Ô]*[Ô] path=[Ô]*.asmx[Ô] preCondition=[Ô]integratedMode[Ô] type=[Ô]System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
<add name=[Ô]ScriptHandlerFactoryAppServices[Ô] verb=[Ô]*[Ô] path=[Ô]*_AppService.axd[Ô] preCondition=[Ô]integratedMode[Ô] type=[Ô]System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
<add name=[Ô]ScriptResource[Ô] preCondition=[Ô]integratedMode[Ô] verb=[Ô]GET,HEAD[Ô] path=[Ô]ScriptResource.axd[Ô] type=[Ô]System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35[Ô]/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns=[Ô]urn:schemas-microsoft-com:asm.v1[Ô]>
<dependentAssembly>
<assemblyIdentity name=[Ô]System.Web.Extensions[Ô] publicKeyToken=[Ô]31bf3856ad364e35[Ô]/>
<bindingRedirect oldVersion=[Ô]1.0.0.0-1.1.0.0[Ô] newVersion=[Ô]3.5.0.0[Ô]/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=[Ô]System.Web.Extensions.Design[Ô] publicKeyToken=[Ô]31bf3856ad364e35[Ô]/>
<bindingRedirect oldVersion=[Ô]1.0.0.0-1.1.0.0[Ô] newVersion=[Ô]3.5.0.0[Ô]/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>


Uso no codigo da pagina:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;


namespace Teste
{
public partial class _Default : System.Web.UI.Page
{
//SqlConnection conn = new SqlConnection(@[Ô]Data Source=.\SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô]);
string conn = ConfigurationManager.ConnectionStrings[[Ô]Default[Ô]].ConnectionString;

protected void Page_Load(object sender, EventArgs e)
{
try
{
SqlCommand cmd = new SqlCommand([Ô]SELECT Codigo, Nome, Telefone FROM Cliente ORDER BY Nome[Ô], conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet dsClientes = new DataSet();
da.Fill(dsClientes, [Ô]Clientes[Ô]);
conn.Open();
GridView1.DataSource = dsClientes.Tables[[Ô]Clientes[Ô]];
GridView1.DataBind();
}
finally
{
conn.Close();
}
}
}
}


Desde já grato pela atenção;
JWCELYO 17/10/2009 17:15:42
#325583
mas vocÊ esta testando no servidor local da sua maquina ou em servidor web de hospedagem
MADUJR 17/10/2009 18:45:15
#325586
Citação:

JWCELYO escreveu:
mas vocÊ esta testando no servidor local da sua maquina ou em servidor web de hospedagem



local...

Muito obrigado;
JWCELYO 17/10/2009 19:46:52
#325589
se da para você posta o protejo em asp.net aqui fica mais fácil descobrimos o que esta acontecendo com sua pagina asp.net ?
RAMSES 17/10/2009 22:53:37
#325595
Resposta escolhida
Citação:


[txt-color=#ff0000] <connectionStrings>[/txt-color]
<add name=[Ô]Default[Ô] connectionString=[Ô]Data Source=.\SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô] providerName=[Ô]System.Data.SqlClient[Ô]/>
<connectionStrings/>

MADUJR 18/10/2009 15:09:42
#325613
Citação:

RAMSES escreveu:

[txt-color=#ff0000] <connectionStrings>[/txt-color]
<add name=[Ô]Default[Ô] connectionString=[Ô]Data Source=.SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô] providerName=[Ô]System.Data.SqlClient[Ô]/>
<connectionStrings/>




Tentei retirar o <connectionStrings> mas continuou dando o mesmo erro .....

Alguém tem alguma ideia ?

Obrigado;
RAMSES 18/10/2009 19:40:58
#325621
Citação:

MADUJR escreveu:
RAMSES escreveu:

[txt-color=#ff0000] <connectionStrings>[/txt-color]
<add name=[Ô]Default[Ô] connectionString=[Ô]Data Source=.SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô] providerName=[Ô]System.Data.SqlClient[Ô]/>
<connectionStrings/>



Tentei retirar o <connectionStrings> mas continuou dando o mesmo erro .....

Alguém tem alguma ideia ?

Obrigado;



o que ta em vermelho eh o que falta no we.config
MADUJR 18/10/2009 20:21:08
#325624
Citação:

RAMSES escreveu:
MADUJR escreveu:
RAMSES escreveu:

[txt-color=#ff0000] <connectionStrings>[/txt-color]
<add name=[Ô]Default[Ô] connectionString=[Ô]Data Source=.SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô] providerName=[Ô]System.Data.SqlClient[Ô]/>
<connectionStrings/>



Tentei retirar o <connectionStrings> mas continuou dando o mesmo erro .....

Alguém tem alguma ideia ?

Obrigado;


o que ta em vermelho eh o que falta no we.config




ele sublinha os dois de vermelho como erro e ao tentar rodar ele traz a mensagem [Ô]Error expecting end tag </connectionStrings>.[Ô]

Obrigado;
RAMSES 18/10/2009 23:07:07
#325636
agora com certeza vai hahaha

  
<connectionStrings>
<add name=[Ô]Default[Ô] connectionString=[Ô]Data Source=.SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô] providerName=[Ô]System.Data.SqlClient[Ô]/>
</connectionStrings>
MADUJR 19/10/2009 09:16:14
#325655
Citação:

RAMSES escreveu:
agora com certeza vai hahaha

  
<connectionStrings>
<add name=[Ô]Default[Ô] connectionString=[Ô]Data Source=.SQLEXPRESS;Initial Catalog=testedb;Integrated Security=True[Ô] providerName=[Ô]System.Data.SqlClient[Ô]/>
</connectionStrings>




Perfeito deu certo !!!!


Muito obrigado;
Tópico encerrado , respostas não são mais permitidas