System.Data.SqlClient.SqlException:登录失败的用户'ASPHOST166\IWAM_plesk(默认)' [英] System.Data.SqlClient.SqlException: Login failed for user 'ASPHOST166\IWAM_plesk(default)'

查看:128
本文介绍了System.Data.SqlClient.SqlException:登录失败的用户'ASPHOST166\IWAM_plesk(默认)'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗?一切都在Visual Studio中正常工作,但不在远程服务器上。我尝试访问该页面登录并注销,但是有相同的错误。
错误:System.Data.SqlClient.SqlException:用户ASPHOST166\IWAM_plesk(默认)登录失败。



Web.confing: / p>

 <?xml version =1.0encoding =utf-8?> 
<! -
有关如何配置ASP.NET应用程序的更多信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
- >
< configuration>
< connectionStrings>
< add name =ConnectionStringconnectionString =Data Source = ASPHOST166\SQL2008R2,778; Initial Catalog = Rennoz_DATABASEMDF; User ID = Rennoz_Admin; Password = *****providerName =System.Data。的SqlClient/>
< add name =ApplicationServicesconnectionString =Data Source = ASPHOST166\SQL2008R2,778; Initial Catalog = Rennoz_DATABASEMDF; User ID = Rennoz_Admin; Password = *****providerName =System.Data。 SqlClient/>
< add name =DatabaseEntitiesconnectionString =metadata = res://*/App_Code.Model.csdl | res://*/App_Code.Model.ssdl | res://*/App_Code.Model .msl; provider = System.Data.SqlClient; provider connection string =& quot; Data Source = ASPHOST166\SQL2008R2,778; Initial Catalog = Rennoz_DATABASEMDF; User ID = Rennoz_Admin; Password = *****; Integrated Security = True; User Instance = True; MultipleActiveResultSets = True& quot; providerName =System.Data.EntityClient/>
< / connectionStrings>
< system.web>
< compilation debug =falsetargetFramework =4.0>
< assembly>
< add assembly =System.Security,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = B03F5F7F11D50A3A/>
< add assembly =System.Data.Entity,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = B77A5C561934E089/>
< add assembly =System.Data.Entity.Design,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = B77A5C561934E089/>
< / assemblies>

< buildProviders>
< add extension =。edmxtype =System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider/>
< / buildProviders>
< / compilation>
< customErrors mode =Off>< / customErrors>
< trace mostRecent =trueenabled =truerequestLimit =1000pageOutput =falselocalOnly =true/>
< authentication mode =Forms/>
< membership>
< providers>
< clear />
< add name =AspNetSqlMembershipProvidertype =System.Web.Security.SqlMembershipProviderconnectionStringName =ApplicationServicesenablePasswordRetrieval =falseenablePasswordReset =truerequiresQuestionAndAnswer =falserequiresUniqueEmail =falsemaxInvalidPasswordAttempts = 5minRequiredPasswordLength =6minRequiredNonalphanumericCharacters =0passwordAttemptWindow =10applicationName =//>
< / providers>
< / membership>
<个人资料>
< providers>
< clear />
< add name =AspNetSqlProfileProvidertype =System.Web.Profile.SqlProfileProviderconnectionStringName =ApplicationServicesapplicationName =//>
< / providers>
< / profile>
< roleManager enabled =true>
< providers>
< clear />
< add connectionStringName =ApplicationServicesapplicationName =/
name =AspNetSqlRoleProvidertype =System.Web.Security.SqlRoleProvider/>
< add applicationName =/name =AspNetWindowsTokenRoleProvider
type =System.Web.Security.WindowsTokenRoleProvider/>
< / providers>
< / roleManager>
< /system.web>
< system.webServer>
< modules runAllManagedModulesForAllRequests =true/>
< /system.webServer>
< location path =审核>
< system.web>
<授权>
< allow roles =Admin/>
< deny users =*/>
< / authorization>

< /system.web>

< / location>
< / configuration>

页面后面的代码(插入):

  protected void EntityDataSource1_Inserting1(object sender,EntityDataSourceChangingEventArgs e)
{
好​​图片=(好)e.Entity;
//pic.PhotoAlbumId = photoalbumid;
FileUpload fileupload1 =(FileUpload)ListView1.InsertItem.FindControl(FileUpload1);
string virtualFolder =〜/ pics /;
string fizfolder = Server.MapPath(virtualFolder);
string filename = Guid.NewGuid()。ToString();
string extension = System.IO.Path.GetExtension(fileupload1.FileName);

fileupload1.SaveAs(System.IO.Path.Combine(fizfolder,filename + extension));
pic.ImageURL = virtualFolder + filename + extension;
pic.Date = System.DateTime.Today;

}


解决方案

看起来像您的应用程序运行在SQL Server中不存在的帐户下。因此,您在Entity Framework的连接字符串中指定了登录名和密码,我想您需要从此实体框架连接字符串中删除 Integrated Security = True;

 < add name =DatabaseEntities
connectionString =metadata = res://*/App_Code.Model.csdl | res:/ /*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string =& quot;数据源= ASPHOST166\SQL2008R2,778;初始目录= Rennoz_DATABASEMDF; User ID = Rennoz_Admin; Password = *****; Integrated Security = True; User Instance = True; MultipleActiveResultSets = True& quot;
providerName =System.Data.EntityClient/>

更新:根据您的错误消息,您的SQL Server版本不支持用户实例登录标志。所以也删除 User Instance = True; 参数。


could anyone help me with this ? Everything works fine in Visual Studio, but does not on a remote server. I have tried to access the page while logged in and logged out, but has got the same error. Error : "System.Data.SqlClient.SqlException: Login failed for user 'ASPHOST166\IWAM_plesk(default)'."

Web.confing:

 <?xml version="1.0" encoding="utf-8"?>
 <!--
    For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
 -->
 <configuration>
 <connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=ASPHOST166\SQL2008R2,778; Initial Catalog=Rennoz_DATABASEMDF; User ID=Rennoz_Admin; Password=*****" providerName="System.Data.SqlClient"/> 
    <add name="ApplicationServices" connectionString="Data Source=ASPHOST166\SQL2008R2,778; Initial Catalog=Rennoz_DATABASEMDF; User ID=Rennoz_Admin; Password=*****" providerName="System.Data.SqlClient" />
    <add name="DatabaseEntities" connectionString="metadata=res://*/App_Code.Model.csdl|res://*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ASPHOST166\SQL2008R2,778; Initial Catalog=Rennoz_DATABASEMDF; User ID=Rennoz_Admin; Password=*****;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
<system.web>
 <compilation debug="false" targetFramework="4.0">
   <assemblies>
     <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
     <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    </assemblies>

  <buildProviders>
    <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
  </buildProviders>
</compilation>
  <customErrors mode="Off"></customErrors>
  <trace mostRecent="true" enabled="true" requestLimit="1000" pageOutput="false" localOnly="true"/>
 <authentication mode="Forms" />
 <membership>
   <providers>
     <clear />
     <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
   </providers>
 </membership>
 <profile>
  <providers>
    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
   </providers>
 </profile>
 <roleManager enabled="true">
   <providers>
     <clear />
     <add connectionStringName="ApplicationServices" applicationName="/"
      name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
    <add applicationName="/" name="AspNetWindowsTokenRoleProvider"
      type="System.Web.Security.WindowsTokenRoleProvider" />
   </providers>
 </roleManager>
</system.web>
<system.webServer>
 <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
 <location path="Moderation">
     <system.web>
        <authorization>
            <allow roles="Admin" />
                <deny users="*" />
            </authorization>

        </system.web>

    </location>
 </configuration>

Code behind the page (inserting) :

 protected void EntityDataSource1_Inserting1(object sender, EntityDataSourceChangingEventArgs e)
 {
     Good pic = (Good)e.Entity;
     //pic.PhotoAlbumId = photoalbumid;
     FileUpload fileupload1 = (FileUpload)ListView1.InsertItem.FindControl("FileUpload1");
     string virtualFolder = "~/pics/";
     string fizfolder = Server.MapPath(virtualFolder);
     string filename = Guid.NewGuid().ToString();
     string extension = System.IO.Path.GetExtension(fileupload1.FileName);

     fileupload1.SaveAs(System.IO.Path.Combine(fizfolder, filename + extension));
     pic.ImageURL = virtualFolder + filename + extension;
     pic.Date = System.DateTime.Today;

 }

解决方案

Looks like your application runs under account which is not exist in SQL server. Thus you have login and password specified in connection string for Entity Framework, I think you need remove Integrated Security=True; from this Entity Framework connections string:

<add name="DatabaseEntities" 
     connectionString="metadata=res://*/App_Code.Model.csdl|res://*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ASPHOST166\SQL2008R2,778; Initial Catalog=Rennoz_DATABASEMDF; User ID=Rennoz_Admin; Password=*****;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" 
     providerName="System.Data.EntityClient" />

UPDATE: According to your error message, user instance login flag is not supported on your version of SQL server. So remove also User Instance=True; parameter.

这篇关于System.Data.SqlClient.SqlException:登录失败的用户'ASPHOST166\IWAM_plesk(默认)'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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