+ -
当前位置:首页 → 问答吧 → .NET网站转移之后怎么样连接数据库

.NET网站转移之后怎么样连接数据库

时间:2011-07-29

来源:互联网

我是没有玩过ASP、.NET和MSSQL的人

服务器硬盘出问题了,紧急转移网站和数据库。

现在在新硬盘上面,安装了SQL2005(验证方式为window登录),附加了之前的数据库sports,网站找了很多文件,老是连接不了数据库

web.config设置如下

IIS还需要设置什么吗?
复制内容到剪贴板
代码:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="strCon" providerName="SqlServer" connectionString="Data Source=127.0.0.1;Integrated Security=SSPI;Initial Catalog=sports;"/>
</connectionStrings>
<system.web>
<pages styleSheetTheme="Default"/>
<httpHandlers>
<!--添加ajax设置-->
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
</httpHandlers>
<!--上传文件大小限制-->
<httpRuntime executionTimeout="600" maxRequestLength="102400" useFullyQualifiedRedirectUrl="false"/>
<compilation debug="false" />
<authentication mode="Forms">
<forms name="Sports" loginUrl="Login.aspx" protection="All" path="/"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<customErrors mode="RemoteOnly" defaultRedirect="Error.htm">
</customErrors>
</system.web>
</configuration>

附件

未命名.JPG (48.58 KB)

2011-7-29 11:06

未命名2.JPG (50.19 KB)

2011-7-29 11:06

作者: aeleven   发布时间: 2011-07-29

把你服务器的.Net版本调整到2.0或以上……

作者: xxs8418   发布时间: 2011-07-30