ASP.Net membership + sql server 2008

故事扮演 提交于 2019-12-13 03:53:56

问题


Update:

Forgot to mention that the app only breaks and shows that error when I try to login as asp.net membership user (sql membership provider), before that everything is fine and the app communicates with the sql just fine.

I'm writing an asp.net app that's using asp.net sqlmembership and connecting to a SQL Server 2008 database remotely via VPN,

Connection string:

add name="MonoSqlServer" connectionString="Data Source=MONO;  
Initial Catalog=SMSPortal;Integrated Security=SSPI;"

This works perfectly if I use the inbuilt http server that comes with visual studio, but if I deploy this to my local IIS (same machine as the inbuilt server) I get an exception:

Exception Details: System.Data.SqlClient.SqlException: Login failed.   
The login is from an untrusted domain and cannot be used with Windows authentication.

What am I doing wrong?


回答1:


Apparently your SQL server is in an AD domain that doesn't have trusts established with the domain that your web server and it's aspnet user is in.

Try using sql server auth, i.e. username and password. I think you will have success.




回答2:


Grant NetworkServices (or whatever account you are using for IIS) access to your membership database




回答3:


Your ASPNET user doesn't have permission to access the VPN. When you're running in debug under Cassini server, you're accessing the VPN via your own user. You need to either provide the local ASPNET user with permission to the SQL server and VPN or configure your application to use a user account that has access to both.



来源:https://stackoverflow.com/questions/2256341/asp-net-membership-sql-server-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!