本文介绍了使用ASP.NET连接到数据库时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨亲爱的,Hi Dears,I moved my site from Goodaddy to 1and 1 hosting .The database was uploaded on remote desktop plesk ..The master database consists of two databases, each with a Web site .The second site no longer works with me database after modifying the connection string to new source sql server 这是我的webconfig :this is my webconfig :<pre><?xml version="1.0"?><configuration> <configSections> <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/> </configSections> <connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Data Source=212. ....,1433;Network Library=DBMSSOCN;Initial Catalog=training;Persist Security Info=True;User ID=sa;Password=123;Max Pool Size=100;" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <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> <httpHandlers/> <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="de-DE"/> <customErrors mode="Off"/> <compilation debug="false" strict="false" explicit="true" targetFramework="4.5" urlLinePragmas="true"> <assemblies> <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <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.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> </assemblies> </compilation> <httpModules> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/> </httpModules> </system.web> <system.webServer> <defaultDocument> <files> <clear/> <add value="Main.aspx" /> </files> </defaultDocument> <modules runAllManagedModulesForAllRequests="true"> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule"/> </modules> <validation validateIntegratedModeConfiguration="false"/> <handlers> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/> <remove name="ExtensionlessUrlHandler-Integrated-4.0"/> <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/> <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/> </handlers> </system.webServer> <rewriter> <rewrite url="~/?Page=(.+)" to="~/Page.aspx?Pageid=$1"/> </rewriter> <system.web> <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices> <sessionState timeout="90" /> </system.web></configuration> 我尝试过: < connectionStrings> < remove name =LocalSqlServer/> < add name =LocalSqlServerconnectionString =Data Source = 212。 ....,1433;网络库= DBMSSOCN;初始目录=训练;持久安全信息=真;用户ID = sa;密码= 123;最大池大小= 100; providerName = System.Data.SqlClient/> < / connectionStrings>What I have tried:<connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Data Source=212. ....,1433;Network Library=DBMSSOCN;Initial Catalog=training;Persist Security Info=True;User ID=sa;Password=123;Max Pool Size=100;" providerName="System.Data.SqlClient" /> </connectionStrings>推荐答案 我尝试过: < connectionStrings> < remove name =LocalSqlServer/> < add name =LocalSqlServerconnectionString =Data Source = 212。 ....,1433;网络库= DBMSSOCN;初始目录=训练;持久安全信息=真;用户ID = sa;密码= 123;最大池大小= 100; providerName = System.Data.SqlClient/> < / connectionStrings>What I have tried:<connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Data Source=212. ....,1433;Network Library=DBMSSOCN;Initial Catalog=training;Persist Security Info=True;User ID=sa;Password=123;Max Pool Size=100;" providerName="System.Data.SqlClient" /> </connectionStrings> 这篇关于使用ASP.NET连接到数据库时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-15 19:04