如何为Web应用程序配置Web.config [英] how to configure the Web.config for web application

查看:84
本文介绍了如何为Web应用程序配置Web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在研究Web应用程序项目,该项目几乎完成了,我已经在Web托管公司中上传了应用程序和数据库.

我遇到类似
的错误

Hi guys,

I''m working on web application projects, its almost completed, I have uploaded the application and database in the web hosting company.

I''m getting the error like


"System.Data.SqlClient.SqlException:无法打开登录请求的数据库数据库名称".登录失败.
用户"WINDOWS8-INDIA \ IWAM_plesk(默认)"的登录失败

"System.Data.SqlClient.SqlException: Cannot open database "databasename" requested by the login. The login failed.
Login failed for user ''WINDOWS8-INDIA\IWAM_plesk(default)''"


<appsettings>
   <add key="ConnectionString" value="server=localhost;database=databasename;uid=username;pwd=pwd;integrated security=true;" />
  </appsettings>



认为在web.config中会出现错误.

在本地系统中,它工作正常,但是在服务器中,我遇到了以上错误.

任何人都可以提供解决方案.

在此先感谢您.



In thought in web.config will have error.

In local system it was working fine but in the server I''m getting the above error.

Can anyone give the solution.

Thanks in advance.

推荐答案

您已将数据库连接设置为使用Windows身份验证,但是IIS服务器帐户不是域帐户...并且它真的不应该.

使用SQL Server身份验证可能是最简单的解决方法,但是可以使用Windows身份验证并将用户的凭据通过IIS服务器传递给数据库...如果您不介意重新配置服务器,则可以使用.如果您使用Google"IIS双跳",那么您会明白为什么我说另一种方式最简单.
You''ve got the database connection set to use Windows Authentication, but the IIS server account is not a domain account...and it really shouldn''t be.

Using SQL Server authentication is probably the easiest fix for this, but it''s possible to use Windows authentication and pass the user''s credentials through the IIS server to the database...if you don''t mind reconfiguring the servers. If you Google "IIS double hop" you''ll see why I say the other way is easiest.


除了GenJerDan的评论,我还注意到您有Integrated Security设置为打开,但您仍然在其中有用户名和密码.
In addition to GenJerDan''s comments, I notice that you have Integrated Security set on yet you still have userID and password in there.


这篇关于如何为Web应用程序配置Web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆