首页 \ 问答 \ MVC4 Source和VS2010(MVC4 Source and VS2010)

MVC4 Source和VS2010(MVC4 Source and VS2010)

背景:

根据http://aspnetwebstack.codeplex.com/documentation上的文档(在“获取和构建代码”下,第一个项目说:

The easiest way to work with our source is to install Visual Studio 2010 (with SP1).

我正在运行VS2010 SP1,并设法按照所有说明启动并运行此源代码(在我的Win7 64位计算机上)。 我安装了.NET 4.5框架。

问题:

在构建期间(从命令行)以及从Visual Studio本身,我收到以下错误:

"The project file 'MY_LOCAL_PATH\src\System.Net.Http.Formatting.NetCore\System.Net.Http.Formatting.NetCore.csproj' cannot be opened. The project type is not supported."

有谁知道如何加载这个项目? Runtime.sln中的所有其他加载正常。

更新:

项目文件(csproj)中的两个项目类型guid是BC8A1FFA-BEE3-4634-8014-F334798102B3FAE04EC0-301F-11D3-BF4B-00C04F79EFBC 。 第一个与Metro有关,另一个是C#。 我可以理解地铁挂断,但文档说VS2010 SP1还不错。


Background:

According to the documentation at http://aspnetwebstack.codeplex.com/documentation (under 'Getting and Building the Code' the very first item says:

The easiest way to work with our source is to install Visual Studio 2010 (with SP1).

I am running VS2010 SP1 and have managed to follow all of the instructions to get this source code up and running (on my Win7 64 bit machine). I am have the .NET 4.5 framework installed.

Problem:

During the build (from the command line) as well as from Visual Studio itself, I get the following error:

"The project file 'MY_LOCAL_PATH\src\System.Net.Http.Formatting.NetCore\System.Net.Http.Formatting.NetCore.csproj' cannot be opened. The project type is not supported."

Does anyone know how to get this project to load? All of the others in the Runtime.sln load fine.

UPDATE:

The two project type guids that are in the project file (csproj) are BC8A1FFA-BEE3-4634-8014-F334798102B3 and FAE04EC0-301F-11D3-BF4B-00C04F79EFBC. The first has something to with Metro and the other is C#. I could understand the metro hangup but again the documentation says VS2010 SP1 is fine.


原文:https://stackoverflow.com/questions/12412123
更新时间:2023-01-03 10:01

最满意答案

我没有找到一个很好的方法来做到这一点。 我没有使用:omniauthable ,我正在单独使用OmniAuth和Devise,如Railscast中所见,其中有两个表usersauthentications 。 这有点hacky只适用于Facebook。

基本上,通过SSL或类似的方式将您的access_token从iPhone发送到服务器。 您必须首先检查OmniAuth,如果您被授予访问权限,那么您可以通过以下方式手动创建与OmniAuth的会话:

尽管如此,我确实得到了一些工作:

FB = OmniAuth::Strategies::Facebook.new("nothing") 

client = ::OAuth2::Client.new("nothing", "nothing", FB.client_options) 

cached_token = "app_id_part|session_id_part|token_part" # or maybe you sent it from the iPhone
access_token = ::OAuth2::AccessToken.new(client, cached_token)  

FB.instance_variable_set("@access_token", access_token) 

FB.auth_hash 
# You will either get a hash or get this error:
# OAuth2::AccessDenied: Received HTTP 401 during request.

之后,您可以通过Authentications表查找查找用户所需的用户信息:

@user = Authentication.where(:uid => FB.auth_hash["uid"], :provider => "facebook").first.user

现在我们创建一个会话:

sign_in_and_redirect(:user, @user)

# or, perhaps

sign_in(@user, :bypass => true)

I have not found a good way of doing this. I am not using :omniauthable either, I'm using OmniAuth and Devise separately as seen in the Railscast episode where there are two tables users and authentications. It's kinda hacky and only works for Facebook.

Basically, send your access_token from the iPhone to the server over SSL, or something similar. You have to check with OmniAuth first and if you are granted access, then you can manually create a session with OmniAuth by going something like:

I did get something to work by doing this though:

FB = OmniAuth::Strategies::Facebook.new("nothing") 

client = ::OAuth2::Client.new("nothing", "nothing", FB.client_options) 

cached_token = "app_id_part|session_id_part|token_part" # or maybe you sent it from the iPhone
access_token = ::OAuth2::AccessToken.new(client, cached_token)  

FB.instance_variable_set("@access_token", access_token) 

FB.auth_hash 
# You will either get a hash or get this error:
# OAuth2::AccessDenied: Received HTTP 401 during request.

After that you lookup the user info you need to find the user via your Authentications table:

@user = Authentication.where(:uid => FB.auth_hash["uid"], :provider => "facebook").first.user

Now we create a session:

sign_in_and_redirect(:user, @user)

# or, perhaps

sign_in(@user, :bypass => true)

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。