我创建了Web应用程序,在登录到欢迎页面后有一个重定向,但在这种情况下标题不会更新.这是我的Angular代码:
MyApp.controller('LoginController', function ($scope) {
$scope.login = function () {
login();
var name = "";
if (document.cookie.indexOf("name") !== -1)
name = document.cookie.split('=')[2];
$scope.menu = [
{
title: 'Product',
url: 'product'
},
{
title: 'About',
url: 'about'
},
{
title: 'Contact',
url: 'contact'
},
{
title: name,
url: 'welcomeUser'
},
{
title: 'LogOut',
url: 'logout'
}
];
$scope.refresh();
};
});
MyApp.controller('MainController', function ($scope) {
var name = "";
if (document.cookie.indexOf("name") !== -1)
name = document.cookie.split('=')[2];
if (document.cookie.indexOf("name") === -1 && (name …Run Code Online (Sandbox Code Playgroud) 我尝试使用SSL创建POST请求,但没有OpenSSL :: SSL :: VERIFY_NONE,因为它会打开安全攻击并且没有PEM证书.但我发现问题,我发送POST请求的ruby代码:
post '/test/test1' do
cross_origin
post_data = request.body.read
res_Data = JSON.parse(post_data)
userName = res_Data['username']
@responseFromServer=''
uri = URI('https://test.com/test1')
Net::HTTP.start(uri.host, uri.port,
:use_ssl => uri.scheme == 'https',
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
request = Net::HTTP::Post.new uri.request_uri
request.basic_auth 'aa', 'bb'
request.body = {'username' =>userName}.to_json
response = http.request request
@responseFromServer = response.body.to_s
end
newJson = JSON.parse(@responseFromServer)
status_msg = newJson['status']['status_msg']
if (status_msg == "Success")
return 'true'
end
return 'false'
end
Run Code Online (Sandbox Code Playgroud)
这是方法工作,但他使用OpenSSL :: SSL :: VERIFY_NONE.如何在没有OpenSSL :: SSL :: VERIFY_NONE和PEM sertificate的情况下创建发送POST请求的方法?
编辑 …
我正在开发一个项目,我有很多子模块.当我创建另一个子模块时,我们必须编译项目并再次部署它.那不是很酷......
我想为此创建一些逻辑来自动化我的工作.我的想法是将子模块上传到Azure blob存储,然后我的项目下载子模块并在我的项目中包含此子模块,而不编译整个项目.
我不知道如何与我现有的软件集成.
我怎样才能做到这一点?
我在Sinatra上创建了应用程序,它代表了一个简单的API.我想在生产和开发上进行部署.我想在部署期间选择,无论是开发还是生产,并且某些方法的逻辑应该根据部署类型进行更改.有什么想法,怎么做以及解决这个问题的一些例子.
示例:我有代码
get '/api/test' do
return "It is dev"
end
Run Code Online (Sandbox Code Playgroud)
但是在部署到生产之后我想在运行/ api/test之后看到
It is PROD
Run Code Online (Sandbox Code Playgroud)
怎么做?
我创建了web-job并进行部署.在设置中,我选择了Web作业运行模式 - > 连续运行.运行我的webjob之后,我会在切换输出控制台的下一条消息中找到:
[07/10/2015 16:29:48> ef6a38:SYS INFO]状态已更改为开始[07/10/2015 16:29:48> ef6a38:SYS WARN]'Always On'似乎未启用这个Web应用程序.为确保在SCM主机空闲时间过长时您的连续作业不会停止运行,请考虑在Web App的配置设置中启用"Always On".注意:"始终开启"仅适用于基本,标准和高级模式.[07/10/2015 16:29:52> ef6a38:SYS INFO]使用脚本主机运行脚本'OptimalyaServer.Migrations.exe' - 'WindowsScriptHost'[07/10/2015 16:29:52> ef6a38:SYS INFO]状态更改为正在运行[07/10/2015 16:56:13> ef6a38:SYS INFO] WebJob因网站关闭而停止[07/10/2015 16:56:13> ef6a38:SYS INFO]状态已更改为停止[07/10/2015 16:56:18> ef6a38:ERR]线程正在中止.
我不知道它为什么会发生以及如何解决它.我希望我的网络工作能够在没有重启和关机的情况下工作.请帮我解决这个问题.谢谢
我在我的项目Owin和Katana中使用OAuth授权.并且所有工作都很好但在global.asax.cs文件中我有一些IOC容器的代码:
Bootstrapper.IncludingOnly.Assembly(Assembly.Load("Dashboard.Rest")).With.SimpleInjector().With.ServiceLocator().Start();
Container container = Bootstrapper.Container as Container;
GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);
Run Code Online (Sandbox Code Playgroud)
我在Startup.cs文件中添加了这段代码,但之后我抓住了下一个异常:
Bootstrapper.dll中出现"Bootstrap.Extensions.Containers.NoContainerException"类型的异常,但未在用户代码中处理
其他信息:无法继续.容器尚未初始化.
如果我调用某人api方法,我会抓住下一个异常:
无法继续.容器尚未初始化.
描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
异常详细信息:Bootstrap.Extensions.Containers.NoContainerException:无法继续.容器尚未初始化.
来源错误:
第21行:public Startup()第22行:{第23行:
Bootstrapper.IncludingOnly.Assembly(Assembly.Load("Dashboard.Rest")).With.SimpleInjector().With.ServiceLocator().Start(); 第24行:容器容器= Bootstrapper.Container作为容器; 第25行:
GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);
我不知道如何解决它.请帮帮我.谢谢.
更新 我有一些SimpleInjectorRegisterTypes类用于连接我的接口和服务:
public class SimpleInjectorRegisterTypes : ISimpleInjectorRegistration
{
public void Register(Container container)
container.RegisterSingle<IApplication, ApplicationService>();
}
}
Run Code Online (Sandbox Code Playgroud)
我在为API编写逻辑的地方提供服务.
在我的控制器中,我使用帮助接口创建用于调用my方法的构造函数:
public class ApplicationController : ApiController
{
private readonly IApplication _application;
public ApplicationController(IApplication application)
{
_application = application;
}
[HttpGet]
public IHttpActionResult GetAllApps()
{
var apps = _application.GetAllApps();
return apps …Run Code Online (Sandbox Code Playgroud) 我有一个Web.Api项目,并将其部署到Azure网站。有时,我在仪表板中看到许多HTTP服务器错误。
详细的错误信息:模块ManagedPipelineHandler通知ExecuteRequestHandler处理程序System.Web.Http.WebHost.HttpControllerHandler错误代码0x800703e3请求的URL http:// test-server:80 / api / Statistics / ShowStories物理路径D:\ home \ site \ wwwroot \ api \ Statistics \ ShowStories登录方法匿名登录用户匿名
我不知道如何解决它以及为什么会发生。
更新
我发现发生这种情况是因为用户断开了Internet连接,接下来是我的问题:如何捕获此问题,也许创建一些自定义异常处理程序,并记录该问题,这是什么“ http服务器错误”,而不会显示在Azure仪表板上?
我在我的角度项目中进行了量角器测试,当我想运行它时,我会捕获下一个异常日志:
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1456:17)
at Socket.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:448:13)
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror …Run Code Online (Sandbox Code Playgroud) 我在项目中使用Bootstrap的Tabs.单击选项卡后,我希望更改URL,如下所示:
/home/first
/home/second
Run Code Online (Sandbox Code Playgroud)
但我不知道如何解决它.这是我的$routeProvider代码:
$routeProvider
.when('/:appId/home', {
templateUrl: 'app/home/home.html',
controller: 'homeController'
})
.when('/:appId/home/first', {
templateUrl: 'app/home/first/first.html',
controller: 'firstController'
})
Run Code Online (Sandbox Code Playgroud)
UPD 指令代码:
'use strict';
angular.module('bootstrap.tabset', [])
.directive('tabset', function () {
return {
restrict: 'E',
replace: true,
transclude: true,
controller: function($scope) {
$scope.templateUrl = '';
var tabs = $scope.tabs = [];
var controller = this;
this.selectTab = function (tab) {
angular.forEach(tabs, function (tab) {
tab.selected = false;
});
tab.selected = true;
};
this.setTabTemplate = function (templateUrl) {
$scope.templateUrl …Run Code Online (Sandbox Code Playgroud) 我有一个 webApi 项目,在部署到开发环境后,我需要编辑 web.config 并将与数据库的连接从生产配置更改为开发配置,如果需要部署到生产配置,则返回。如何在我的项目中使用的发布或调试中为选定的开发或生产自动设置 webconfig?
我在 IE11 中遇到 @HostListener问题。我需要捕捉用户何时使用 keydown 事件作为空格,我的代码非常简单,它在 Chrome 和 FireFox 中运行良好,但在 IE 中不起作用。
import {Component, HostListener} from '@angular/core';
@Component({
selector: 'home',
styleUrls: ['./home.component.css'],
templateUrl: './home.component.html'
})
export class HomeComponent {
@HostListener('window:keydown.control.space', ['$event'])
@HostListener('window:keydown.space', ['$event'])
spaceEvent(event: any) {
alert('space key!');
}
}
Run Code Online (Sandbox Code Playgroud)
在IE开发者工具中,我没有看到任何错误或警告,我不知道如何解决这个问题。任何建议如何解决这个问题?
internet-explorer typescript ecmascript-6 angular2-template angular
我尝试在C#中使用简单的预处理程序指令进行调试和发布模式.
例如:
using System;
public class C {
public void M() {
#if DEBUG
Console.WriteLine("Debug");
#else
Console.WriteLine("Release");
#endif
}
}
Run Code Online (Sandbox Code Playgroud)
这段代码非常简单明了.
但是当我看到IL代码时,我没有关于debug指令的任何内容.
.class private auto ansi '<Module>'
{
} // end of class <Module>
.class public auto ansi beforefieldinit C
extends [mscorlib]System.Object
{
// Methods
.method public hidebysig
instance void M () cil managed
{
// Method begins at RVA 0x2050
// Code size 13 (0xd)
.maxstack 8
IL_0000: nop
IL_0001: ldstr "Release"
IL_0006: call void [mscorlib]System.Console::WriteLine(string)
IL_000b: nop
IL_000c: …Run Code Online (Sandbox Code Playgroud) 我有一个简单mat-table的mat-paginator。
我想更改范围标签的放置并将其放在导航按钮之间,如下所示:
基本上,我需要将div.mat-paginator-range-label元素从此容器的顶部移至button.mat-paginator-navigation-previous和之间button.mat-paginator-navigation-next。
有什么想法吗?谢谢。
c# ×4
angularjs ×3
azure ×3
.net ×2
angular ×2
asp.net ×2
javascript ×2
ruby ×2
sinatra ×2
.net-core ×1
ecmascript-6 ×1
global-asax ×1
jquery ×1
linux ×1
owin ×1
pagination ×1
protractor ×1
ssl ×1
tabs ×1
typescript ×1
web-config ×1