ASP.net应用程序崩溃 – 无法加载文件或程序集“Microsoft.Threa
我想使用OAuth2和.Net 4.5框架构建一个Google BigQuery C#ASP.net应用程序。我运行了这些NuGet安装
Install-Package Google.Apis.Bigquery.v2 -Pre Install-Package Google.Apis.Authentication.OAuth2 -Version 1.2.4696.27634 Install-Package Google.Apis -Pre Install-Package Google.Apis.Auth -Pre 并将相关的“uses”放在代码隐藏文件“default.aspx.cs”中: using System; using System.Collections.Generic; using System.IO; using System.Threading; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Google.Apis.Auth.OAuth2; using Google.Apis.Services; using Google.Apis.Bigquery.v2; using Google.Apis.Bigquery.v2.Data; namespace BigQueryDemoApp { public partial class _Default : Page { protected void Page_Load(object sender,EventArgs e) { UserCredential credential; FileStream stream; using (stream = new FileStream( Server.MapPath("~/client_secrets.json"),FileMode.Open,FileAccess.Read) ) { GoogleWebAuthorizationBroker.Folder = "Tasks.Auth.Store"; credential = GoogleWebAuthorizationBroker. AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets,new[] { BigqueryService.Scope.Bigquery },"user",CancellationToken.None).Result; } // Initialize the service. var Service = new BigqueryService( new BaseClientService.Initializer() { HttpClientInitializer = credential,ApplicationName = "BigQueryDemo" } ); } } } 我将此特定页面设置为项目起始页。当我在Google控制台中建立客户端ID文件时,我选择了“已安装的应用程序” APIS & auth -> Credentials -> CREATE NEW CLIENT ID 我确定我在VS2013中将该文件(client_secrets.json)添加到了解决方案资源管理器中。在代码隐藏中,我确保我使用Server.MapPath映射到client_secrets文件。对于凭证机器,我使用这个代码 <https://code.google.com/p/google-api-dotnet-client/wiki/OAuth2> 为起点。当我运行应用程序,它返回一个浏览器错误页面开头
并在“credential =”行中崩溃。我试图添加一些实际的ASP.net崩溃的浏览器页面的图像显示装配跟踪/堆栈跟踪等,但它看起来像我没有这个帐户的权限。当我在“credential =”行设置断点,然后运行应用程序 DEBUG -> Start Debugging 在VS2013中,页面停在“credential =”行,文件选择器打开,查找文件 "GoogleClientSecrets.cs" 从目录
这是无处不在的。在生成的ASP.net错误页面中使用Assembly Load Trace,我尝试通过建议的配置文件挖掘,但没有任何工作。更一般来说,我试图在StackOverflow中寻找这个问题,而当我确实找到了一些提及的时候,没有一个帮助。 解决方法
因为错误是基于Microsoft.Bcl.Async的最新版本在.NET 4.5中不起作用的事实,您可以尝试执行以下操作:
打开您的软件包管理器控制台,并运行以下命令: 它在我目前正在写的一个样本中。请让我知道,如果它适用于你。 更新(3月21日): (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc – mvc asp.net中的自定义成员资格提供程序或配
- asp.net-mvc – C#Razor Forms – 插入角度属性
- asp.net-mvc – 控制器的实例上的HttpContext在ASP.net MVC
- 如何更新asp.net网站(刚更改的文件)
- ASP.NET MVC的必备知识
- asp.net – 如何将现有Azure Web角色转换为新式Azure网站?
- 从asp.net c#设置style.display
- asp.net – 如何将CssClass应用于DataGrid HyperLinkColumn
- ASP.NET错误处理
- asp.net – 使用@@ identity检索PK
- asp.net – 设置身份验证表单loginUrl动态?
- asp.net-mvc – 带接口的ASP.NET MVC UpdateMode
- asp.net – Application_Start在工作站上工作正常
- entity-framework – 无法从程序集’EntityFrame
- asp.net-mvc-3 – .NET MVC – 一次提交多个相同
- asp.net – 在wcf服务中使用aspNetCompatibility
- asp.net-mvc – 在ASP.NET MVC站点上集成PayPal的
- asp.net – 如何使用app_GlobalResource或app_Lo
- 经典ASP:不支持Server.CreateObject
- asp.net – 使用SignalR在多个Web应用程序之间进