在控制台应用程序访问ASP.Net会员? [英] Accessing ASP.Net Membership in a Console Application?
问题描述
我在写一个简单的工具的控制台应用程序添加新用户,等,到SQL Server的成员资格商店。
I'm writing a simple utility console app to add new users, etc, to an SQL Server Membership Store.
我遇到的问题是,我似乎无法添加的System.Web的引用,所以我不能访问成员资格的东西。一个人如何去这样做呢?
The issue I'm running into is that I can't seem to add a reference to System.Web, so I can't access the Membership stuff. How does one go about doing this?
请注意:我发现在计算器,似乎类似的几个问题,但答案围绕MVC,并试图建议的答复后,问题仍然存在。
NOTE: I've found a few questions on stackoverflow that seem similar, but the answers revolved around MVC, and after attempting the suggested answers, the problem still remains.
编辑:
俄德帮助使我的答案。默认情况下它是由客户端配置文件,它不具有的System.Web可用的过滤。我不得不重新定位到.NET 4,而不是净如下面的MSDN文章中描述4客户端配置文件。
Oded helped lead me to the answer. By default it was filtering by the "client profile", which doesn't have System.Web available. I had to retarget to .Net 4 instead of .Net 4 client profile as described in the following MSDN article.
http://msdn.microsoft.com/en-us/library/ bb398202.aspx
推荐答案
请确保你在你的项目目标的全面框架(右键单击该项目节点并选择属性
) - 在应用
标签有一个下拉的目标框架
Make sure you are targeting the full framework in your project (right click on the project node and select Properties
) - In the Application
tab there is a drop down for Target Framework
.
请确保这不会使用客户端配置文件。
Make sure this does not use a client profile.
这篇关于在控制台应用程序访问ASP.Net会员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!