My Cloud 9工作区使用Node.Js 0.10运行.如何将其更新到最新版本的Node.Js(今天是0.12.4)?
我正在尝试使用apt-get安装Node.Js,但我总是会得到0.10版本.
更新:最新版本的Cloud 9工作区现已预安装4.1.1版
我在.NET 4应用程序上托管了一组WCF服务.我手动创建ServiceHost类并开始侦听TCP端口.所有工作都按预期工作,但在服务器端的WCF跟踪中,我收到以下警告.
找不到配置评估上下文.
XML跟踪如下:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>524312</EventID>
<Type>3</Type>
<SubType Name="Warning">0</SubType>
<Level>4</Level>
<TimeCreated SystemTime="2010-09-03T12:33:01.9404010Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
<Execution ProcessName="Server.Console.vshost" ProcessID="24612" ThreadID="10" />
<Channel />
<Computer>BAROLO</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Warning">
<TraceIdentifier>http://msdn.microsoft.com/it-IT/library/System.ServiceModel.EvaluationContextNotFound.aspx</TraceIdentifier>
<Description>Configuration evaluation context not found.</Description>
<AppDomain>Server.Console.vshost.exe</AppDomain>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
Run Code Online (Sandbox Code Playgroud)
有关警告原因的任何想法?
谢谢
根据Json.Net文档,所有IEnumerable类型都应该序列化为json数组.
所以我期待以下课程:
public class MyClass
{
public IEnumerable<string> Values { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
被序列化为:
{
"Values": []
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我使用时,TypeNameHandling=Auto我得到:
{
"Values": {
"$type": "System.String[], mscorlib",
"$values": []
}
}
Run Code Online (Sandbox Code Playgroud)
我需要TypeNameHandling=Auto其他属性,但我希望IEnumerable使用默认序列化.其他类型(IList例如)按预期工作.
这是一个错误或我错过了什么?
这里是重现问题的完整代码:
[Test]
public void Newtonsoft_serialize_list_and_enumerable()
{
var target = new Newtonsoft.Json.JsonSerializer
{
TypeNameHandling = TypeNameHandling.Auto
};
var myEvent = new MyClass
{
Values = new string[0]
};
var builder = new StringWriter();
target.Serialize(builder, myEvent);
var json …Run Code Online (Sandbox Code Playgroud) 我有一个附加自定义IServiceBehavior的WCF服务,用于返回客户端的特定错误.当我使用TCP消息安全性启用此代码时,我收到服务超时.
您可以在下面看到完整的客户端和服务器代码,以重现错误.
服务器代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
namespace TestWCFServer
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("SERVER");
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Message; //If you remove this line the code works!!!!
Uri address = new Uri("net.tcp://localhost:8184/");
// Create the ServiceHost.
using (ServiceHost host = new ServiceHost(typeof(HelloWorldService)))
{
host.AddServiceEndpoint(typeof(IHelloWorldService), binding, address);
host.Description.Behaviors.Add(new MyErrorhandlerBehavior());
host.Open();
Console.WriteLine("The service is ready at {0}", address);
Console.WriteLine("Press to stop the … 我需要创建一个System.Linq.Expressions.Expression调用动态对象.动态对象可以是ExpandoObject任何其他对象IDynamicMetaObjectProvider.
考虑以下测试:
var myInstance = DateTime.Now;
var methodInfo = myInstance.GetType().GetMethod("ToUniversalTime");
var methodCallExpression = Expression.Call(Expression.Constant(myInstance), methodInfo);
var expression = Expression.Lambda(methodCallExpression);
Assert.AreEqual(myInstance.ToUniversalTime(), expression.Compile().DynamicInvoke());
Run Code Online (Sandbox Code Playgroud)
我需要在声明myInstance时创建一个等效表达式(仅作为示例):
dynamic myInstance = new ExpandoObject();
myInstance.MyMethod = new Func<string>(() => "hello world");
Run Code Online (Sandbox Code Playgroud)
我想我需要使用Expression.Dynamic方法(参见MSDN).但我不知道如何使用它.我试图在谷歌搜索,但我发现的唯一的例子使用无法正式使用的Microsoft.CSharp.RuntimeBinder.Binder类(请参阅MSDN):
此API支持.NET Framework基础结构,不能直接在您的代码中使用.
使用Microsoft.CSharp.RuntimeBinder.Binder我可以编写下面的代码:
dynamic myInstance = new ExpandoObject();
myInstance.MyMethod = new Func<string>(() => "hello world");
var binder = Binder.InvokeMember(
CSharpBinderFlags.None,
"MyMethod",
null,
this.GetType(),
new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.Constant, null) });
var …Run Code Online (Sandbox Code Playgroud) 我们在将我们的软件移植到 Azure 上时遇到了一些问题。我们的解决方案由 2 个网站(前端、后端)和一个 webjob(安装在我们的硬件上的 Win 服务)组成。这些节点使用 RabbitMQ 集群(2 个 Ubuntu VM)进行通信。在本地我们没有任何问题,但在 Azure 上安装时,我们会看到许多错误,例如:
Publisher did not confirm message
Run Code Online (Sandbox Code Playgroud)
或者
Publish not confirmed before channel closed
Run Code Online (Sandbox Code Playgroud)
或者
SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 104.40.186.27:5672
Run Code Online (Sandbox Code Playgroud)
在 RabbitMQ 上,我们看到以下类型的错误:
closing AMQP connection <0.390.0> (100.73.204.90:61152 -> 100.73.205.2:5672):
{handshake_timeout,handshake}
Run Code Online (Sandbox Code Playgroud)
结果是经常无法正确接收消息。
我们在 RabbitMQ 之上使用 MassTransit 进行实际的消息交换。这是我们设置环境的过程:
我们首先在相同的云服务上创建 2 个 Ubuntu 14.04 …
您认为在Cloud9环境中运行ASP.NET 5(vNext)在技术上是否可行?
我已经按照https://github.com/aspnet/home上的文档,一切似乎工作正常,但当我运行命令时:
dnx . kestrel
Run Code Online (Sandbox Code Playgroud)
mono 执行并开始使用100%的CPU但HTTP服务器无法正常工作.
这是我的示例应用程序:https://github.com/davideicardi/aspnet5-on-cloud9
将Azure Web App连接到Azure VM上托管的MongoDb时,我遇到了一些超时问题.
2015-12-19T15:57:47.330+0100 I NETWORK Socket recv() errno:10060 A connection attempt
failed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond.
2015-12-19T15:57:47.343+0100 I NETWORK SocketException: remote: 104.45.x.x:27017 error:
9001 socket exception [RECV_ERROR] server [104.45.x.x:27017]
2015-12-19T15:57:47.350+0100 I NETWORK DBClientCursor::init call() failed
Run Code Online (Sandbox Code Playgroud)
目前mongodb配置在单个服务器上(仅适用于dev),并通过公共IP公开.网站使用azure域名(*.westeurope.cloudapp.azure.com)连接到它,没有虚拟网络.
通常一切都运行良好,但在几分钟不活动后,我得到超时异常.从我的PC上使用MongoDb shell时会发生同样的情况,所以我很确定这是mongodb方面的一个问题.
我错过了一些配置?
azure mongodb azure-virtual-machine azure-virtual-network mongodb-.net-driver
从Azure App Service中的node.js多次调用HTTP [S]终结点时,我遇到一些超时问题。
这里是我的代码来说明问题。
const fetch = require('node-fetch');
const https = require("https");
const agent = new https.Agent();
function doWork() {
const works = [];
for (let i = 0; i < 50; i++) {
const wk = fetch('https://www.microsoft.com/robots.txt', { agent })
.then(res => res.text())
.then(body => console.log("OK", i))
.catch((err) => console.log("ERROR", i, err));
works.push(wk);
}
return Promise.all(works);
}
doWork()
.catch((err) => {
console.log(err);
});
Run Code Online (Sandbox Code Playgroud)
在标准中型应用程序服务中运行此应用程序3或4次(我正在使用Kudu运行它,但我在标准网络应用程序中发现此错误)时,对于每个请求都会收到以下错误:
{ FetchError: request to https://www.microsoft.com/robots.txt failed, reason: connect ETIMEDOUT 23.206.106.109:443
at ClientRequest.<anonymous> (D:\home\site\test\test-forge-calls\node_modules\node-fetch\lib\index.js:1393:11)
at …Run Code Online (Sandbox Code Playgroud) azure node.js azure-web-sites azure-web-app-service node-fetch
我是NEventStore的新手和一般的事件采购.在一个项目中,我想使用NEventStore来持久化聚合生成的事件,但是我有一些问题需要正确处理并发.
如何使用乐观锁写入同一个流?
假设我有2个不同线程在修订版1中加载的相同聚合的2个实例.然后是第一个线程调用命令A和第二个线程调用命令B. 使用乐观锁定其中一个聚合应该失败并出现并发异常.
我想使用maxRevision从加载聚合的点打开流,但似乎CommitChanges永远不会失败,如果我传递旧版本.
我错过了什么?使用NEventStore/Event Sourcing时,乐观锁定可能/正确吗?
这是我用来重现问题的代码:
namespace NEventStore.Example
{
using System;
using System.Transactions;
using NEventStore;
using NEventStore.Dispatcher;
using NEventStore.Persistence.SqlPersistence.SqlDialects;
internal static class MainProgram
{
private static readonly Guid StreamId = Guid.NewGuid(); // aggregate identifier
private static IStoreEvents store;
private static void Main()
{
using (var scope = new TransactionScope())
using (store = WireupEventStore())
{
Client1(revision: 0);
Client2(revision: 0);
scope.Complete();
}
Console.WriteLine(Resources.PressAnyKey);
Console.ReadKey();
}
private static IStoreEvents WireupEventStore()
{
return Wireup.Init()
.UsingInMemoryPersistence()
.Build();
}
private static void Client1(int revision) …Run Code Online (Sandbox Code Playgroud) .net ×4
azure ×3
c# ×3
cloud9-ide ×2
node.js ×2
wcf ×2
asp.net-core ×1
concurrency ×1
dynamic ×1
json.net ×1
lambda ×1
mongodb ×1
mono ×1
neventstore ×1
node-fetch ×1
nvm ×1
rabbitmq ×1
timeout ×1