在我的应用程序中,我使用REST api来获取我的数据.如果发送这样的请求
$http.get('api/entity/' + $scope.entityId).success(/* DO STUFF */).error(/* DO STUFF */)
Run Code Online (Sandbox Code Playgroud)
在服务中,如果entityId不存在,我返回404.在错误函数中,我使用status(第二个参数)捕获它并以适当的方式对其进行操作.
令我恼火的是,如果抛出一个异常并且污染了javascript控制台,则会出现angular.它似乎发生在Angular.js:8165
有没有办法告诉棱角分析我是一个成年的开发人员,我将以一种不错的方式处理他认为是错误的事情?
换句话说,我可以告诉角度不输出那个废话吗?
谢谢,
我们有2个应用程序都使用Asp.Net Identity来提高安全性.
他们彼此无关,但我碰巧是两个项目的开发人员.
我正面临着一个非常恼人的Cookie名称问题.如果我转到app1然后登录到app2并登录,我将从app1断开连接.
我猜测是因为这两个应用程序共享相同的cookie名称.
因此,为了便于开发,也因为我认为它更好,我正在寻找一种方法来更改cookie的名称.
任何线索?
我们正在尝试以正确的方式设置Identity Server 3.我们认证工作正常,我们设法检索刷新令牌.
客户端应用程序正在使用Angular.
现在当acces_token到期时,对其余api的任何调用都失败了(我们设法让它返回401),但我们想知道如何重新验证用户.
在我们的测试中,任何通过Javascript调用的api调用都失败了(401)但是一旦刷新页面,整个机制就开始了.我们确实看到我们被重定向到身份服务器但它没有显示登录页面,我们显然已经用新的令牌发回客户端应用程序.
我想要做的是刷新访问令牌,而不必强迫用户刷新页面.
我不确定的是谁的责任呢?那是客户端应用程序(网站)还是有角度的应用程序?换句话说,如果应用程序透明地处理Angular,或者当它收到401时应该有角度做某事,在这种情况下,我不太确定信息将如何流回Web应用程序.
任何线索?
附加信息:我们正在使用OpenId Connect
我正在开发一个项目,我们在其中使用SqlServer的Geo类型.
为此,我不得不在解决方案中添加一些DLL,这些DLL通过构建过程进行复制:
SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
Run Code Online (Sandbox Code Playgroud)
这在我的机器上运行得非常好,但是我的团队中的人因此而构建错误.我们使用本地IIS来托管解决方案,一旦IIS启动,它们就无法构建.
我们现在发现的唯一解决方案是重新启动应用程序池(但老实说,我们只是输入iisreset)
这是错误消息的一部分(我删除了解决方案/项目名称)
Error 15 Could not copy "C:\Workspace\code-...Error 15 Could not copy "C:\Workspace\My-Awesome-Project\Web\MyAwesomeProject.Web\packages\Microsoft.SqlServer.Types.11.0.1\nativeBinaries\x64\msvcr100.dll" to "bin\SqlServerTypes\x64\msvcr100.dll". Exceeded retry count of 10. Failed.
Run Code Online (Sandbox Code Playgroud)
我相信我的计算机与同事之间存在差异,但我们无法指出可能对问题产生影响的一个区别.
任何线索?
我们的项目使用asp.Net Web Api和我们的部分要求,以便用户通过Excel查看数据,我们想介绍OData Feed.
所以我安装了oData包:
<package id="Microsoft.AspNet.WebApi.OData" version="5.3.0" targetFramework="net45" />
Run Code Online (Sandbox Code Playgroud)
通过这样做,升级了以下包:
- <package id="Microsoft.AspNet.WebApi.Client" version="5.2.0" targetFramework="net45" />
- <package id="Microsoft.AspNet.WebApi.Core" version="5.2.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.Client" version="5.2.2" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.Core" version="5.2.2" targetFramework="net45" />
- <package id="Newtonsoft.Json" version="5.0.6" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Run Code Online (Sandbox Code Playgroud)
我稍微修改了我的WebApiConfig以添加OData路由(但我认为这是无关紧要的,这是我不提供代码的原因).重建失败多次,所以我决定按照多篇博客文章的建议重新启动Visual Studio.
然后所有构建都很好,我在项目上启动调试器.我得到以下异常:
An exception of type 'System.IO.FileLoadException' occurred in Ninject.Web.Common.dll but was not handled in user code
Additional information: Could not load file or assembly 'System.Web.Http, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of …
Run Code Online (Sandbox Code Playgroud) 我们在Azure中遇到了SqlBulkCopy的问题.
上下文如下:我们有一个大约有1000万行的表.每行有大约15列.
我们正在将这些数据迁移到我们的新模型中,这需要拆分数据,因此包含15列的1行变为15行.
它在一开始就很完美.目标表现在包含17 767 235行,并且速度非常快.
此时,它开始抛出异常.
我做了一些修改以增加超时并使用批处理,但似乎它完全被阻止了.
这是最初的例外:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.; TraceSource 'WaWorkerHost.exe' event Services.DataMigration.Edmi_IN_0 5/9/2014 2:44 PM 2 1508 280
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) …
Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中使用Quartz Scheduler并得到异常:Trigger没有引用给定的作业......
看着我的代码我似乎无法看出问题出在哪里.
var schedFact = new StdSchedulerFactory();
scheduler = schedFact.GetScheduler();
IJobDetail dailyJob = JobBuilder.Create<PushElectricityPricesJob>()
.WithIdentity("dailyJob", "group1")
.Build();
ITrigger trigger1 = TriggerBuilder.Create()
.WithIdentity("dailyJobTrigger", "group1")
.StartNow()
.WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(3, 0))
.ForJob("dailyJob")
.Build();
scheduler.ScheduleJob(dailyJob, trigger1);
IJobDetail monthlyJob = JobBuilder.Create<PushContributionsJob>()
.WithIdentity("monthlyJob", "group2")
.Build();
ITrigger trigger2 = TriggerBuilder.Create()
.WithIdentity("monthlyJobTrigger", "group2")
.StartNow()
.WithSchedule(CronScheduleBuilder.MonthlyOnDayAndHourAndMinute(1, 0, 0))
.ForJob("monthlyJob")
.Build();
scheduler.ScheduleJob(monthlyJob, trigger2);
scheduler.Start();
Run Code Online (Sandbox Code Playgroud)
我确实在StackOverflow上找到了很多像这样的帖子,但是在每一个帖子上我都可以发现开发者所犯的错误或拼写错误.在这里,我只是无能为力..
任何的想法?
我正在尝试在全新的 dotnet 核心应用程序上设置身份验证。我使用的 IdentityServer 工作正常,因为它被用于其他应用程序。
我收到的错误只是“关联失败”。查看 VS2017 中的输出,我在异常之前看到一个警告,内容如下:
Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler:警告:.AspNetCore.Correlation。未找到国家财产。
这是我的配置:
public void ConfigureServices(IServiceCollection services)
{
Debugger.Break();
services.AddMvc();
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
options.SlidingExpiration = true;
options.Cookie.Name = "MyAwesomeCookie";
options.ExpireTimeSpan = TimeSpan.FromMinutes(30);
})
.AddOpenIdConnect(options =>
{
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.Authority = IdentityServerConstants.IdentityServerUrl;
options.ClientId = "myclientid";
options.ClientSecret = "supersecuresecret";
//options.CorrelationCookie.Name = "something";
foreach (var s in myScopes)
{
options.Scope.Add(s);
}
options.ResponseType = "code id_token token";
options.CallbackPath = new PathString("/");
options.UseTokenLifetime = false;
options.RequireHttpsMetadata = …
Run Code Online (Sandbox Code Playgroud) 我有一个今天早上运行良好的 azure 函数(在 Azure 上发布)。我不得不在 Azure 存储中添加一些日志记录功能,突然间我无法再运行我的功能。我没有尝试发布它,因为它不在本地运行。
症状是我收到以下异常:
System.IO.FileNotFoundException: '找不到文件'C:\projects\MySuperFunction\MySuperFunction\bin\Debug\netstandard2.0\bin\function.json'。'
我读到 thtis 文件应该在构建时生成,但我可以确认该文件根本不存在。
我对项目所做的唯一修改是添加了对 WindowsAzure.Storage nuget 包 (v9.2.0) 的引用
有谁知道为什么它现在失败而以前没有,理想情况下,如何让它恢复工作?
我正在尝试使用以下请求调用outlook API:
https://outlook.office.com/api/v2.0/me/calendars
GET
Authorization: Bearer [my fresh bearer token]
Run Code Online (Sandbox Code Playgroud)
登录和用户同意后,我成功从令牌端点检索了access_token.
但是,我尝试的每个请求都会使用以下标题返回401 Unauthorized(显示一个因为它看起来很奇怪):
WwwAuthenticate [HttpHeaderValueCollection]: {Bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000@*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token", Basic Realm="", Basic Realm="", Basic Realm=""}
Run Code Online (Sandbox Code Playgroud)
如您所见,最后有错误="invalid_token"
此外,还有app_asserted_user_v1 service_asserted_app_v1
有没有我忘记激活或配置正确的东西?
编辑:我确实找到了这篇文章,但如果我添加像OP这样的资源参数,我得到"错误的请求"和这段代码:
AADSTS90100:不支持"资源"请求参数.
.net ×2
angularjs ×2
asp.net ×2
azure ×2
c# ×2
.net-core ×1
build ×1
cookies ×1
iis ×1
javascript ×1
odata ×1
rest ×1
sql-server ×1
sqlbulkcopy ×1