在SignalR Performance页面中,我们可以阅读:
此上下文中的流是缩小提供者使用的缩放单位; 如果使用SQL Server,则使用表,如果使用Service Bus,则使用主题;如果使用Redis,则使用Subscription.每个流确保有序的读写操作; 一个单一的数据流是一个潜在的规模瓶颈,因此可以增加流的数量,以帮助减少瓶颈.如果使用多个流,SignalR将自动在这些流上分发(分片)消息,以确保从任何给定连接发送的消息按顺序排列.
流计数(即SQL中的表)可以像这样设置:
var connectionString = "(your connection string)";
var config = new SqlScaleoutConfiguration(connectionString) {
TableCount = 3,
MaxQueueLength = 50 };
GlobalHost.DependencyResolver.UseSqlServer(config);
Run Code Online (Sandbox Code Playgroud)
但是TableCount在SQL scaleout中默认为1.如果这是一个规模瓶颈,为什么它默认为1?如果我将它设置为50怎么办?
文档没有给出任何线索来决定给出哪个值.我应该将它设置为1,3,10,1000吗?什么是大价值的利弊?它只会增加延迟吗?
根据AutoMapper文档,我应该能够使用以下方法创建和使用自定义类型转换器的实例:
var dest = Mapper.Map<Source, Destination>(new Source { Value = 15 },
opt => opt.ConstructServicesUsing(childContainer.GetInstance));
Run Code Online (Sandbox Code Playgroud)
我有以下源和目标类型:
public class Source {
public string Value1 { get; set; }
public string Value2 { get; set; }
public string Value3 { get; set; }
}
public class Destination {
public int Value1 { get; set; }
public DateTime Value2 { get; set; }
public Type Value3 { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
以下类型的转换器:
public class DateTimeTypeConverter : ITypeConverter<string, DateTime> {
public DateTime …Run Code Online (Sandbox Code Playgroud) 我是MEF的新手,正在尝试使用ExportFactory.我可以使用ExportFactory根据用户插入对象创建列表吗?样本将类似于下面显示的内容.我可能不理解ExportFactory的使用,因为在运行时我在组合期间得到如下所示的错误.
1)没有找到符合约束'((exportDefinition.ContractName =="System.ComponentModel.Composition.ExportFactory(CommonLibrary.IFoo)")AndAlso(exportDefinition.Metadata.ContainsKey("ExportTypeIdentity")AndAlso"System"的有效导出). ComponentModel.Composition.ExportFactory(CommonLibrary.IFoo)".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))',无效导出可能已被拒绝.
class Program
{
static void Main(string[] args)
{
Test mytest = new Test();
}
}
public class Test : IPartImportsSatisfiedNotification
{
[Import]
private ExportFactory<IFoo> FooFactory { get; set; }
public Test()
{
CompositionInitializer.SatisfyImports(this);
CreateComponent("Amp");
CreateComponent("Passive");
}
public void OnImportsSatisfied()
{
int i = 0;
}
public void CreateComponent(string name)
{
var componentExport = FooFactory.CreateExport();
var comp = componentExport.Value;
}
}
public interface IFoo
{
double Name { get; set; }
}
[ExportMetadata("CompType", "Foo1")]
[Export(typeof(IFoo))]
[PartCreationPolicy(System.ComponentModel.Composition.CreationPolicy.NonShared)]
public …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Windows Azure存储客户端库的v2.0为blob生成共享访问签名(并使用它).我从这个示例开始,但它是针对v1.7,并将其转换为2.0会产生404错误.
这是我的实际代码:服务器端,生成SAS:
var myAccount = CloudStorageAccount.Parse(
ConfigurationManager.ConnectionStrings[
"AzureStorageConnectionString"].ConnectionString);
var myContainer = myAccount.CreateCloudBlobClient()
.GetContainerReference(containerName);
myContainer.CreateIfNotExists();
string blobName = "Imports/" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss")
+ ".zip";
var myBlob = myContainer.GetBlockBlobReference(blobName);
using (var stream =
new MemoryStream(System.Text.Encoding.UTF8.GetBytes("Hey, I'm empty for now.")))
{
myBlob.UploadFromStream(stream);
}
var sharedAccesSignature = myBlob.GetSharedAccessSignature(
new Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPolicy()
{
Permissions =
Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions.Write
| Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions.Read,
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(1),
});
return myBlob.Uri.AbsoluteUri + sharedAccesSignature;
Run Code Online (Sandbox Code Playgroud)
它在客户端尝试了很多东西,有时导致404或403服务器错误.例如,我试过这个(结果:404):
var blobClient = new CloudBlobClient(new Uri(blobWithSharedAccessSignature));
// blobWithSharedAccessSignature here is : https://azertyuiop.blob.core.windows.net/container1/Imports/2012-12-01_19-43-54.zip?sv=2012-02-12&se=2012-12-01T20%3A43%3A54Z&sr=b&sp=rw&sig=h0bTUk[...]3D
// calling blobWithSharedAccessSignature …Run Code Online (Sandbox Code Playgroud) 我正在将应用程序迁移到SQL Azure Federation,我喜欢在没有SQL的情况下查看和编辑表格内容(它仅用于测试).
使用标准SQL数据库(SQL Server或SQL Azure),我可以使用以下方法之一:
Management Studio(SSMS)查看和编辑数据:右键单击表>编辑顶部xx行.
Visual Studio:在服务器资源管理器中,我连接到我的数据库,右键单击一个表,然后单击"显示表数据".
当然,这对SQL Azure Federation不起作用.您是否知道一个工具(甚至简单),免费(如果可能),在联盟成员中编辑我的数据?
我是mef的初学者,所以我有一个问题:)我有以下内容:
[PartCreationPolicy(CreationPolicy.Shared)]
[Export(typeof(SharedExport))]
public class SharedExport : INPCBase
{
[ImportMany(typeof(INonShared),RequiredCreationPolicy = CreationPolicy.NonShared)]
private IEnumerable<Lazy<INonShared,Dictionary<string,object>>> fac;
...
public void Open()
{
foreach (var lazy in fac)
{
this.Muster.Add(lazy.Value);
}
}
Run Code Online (Sandbox Code Playgroud)
导入的所有类都标记为非共享.
[PartCreationPolicy(CreationPolicy.NonShared)]
[Export(typeof(INonShared))]
[ExportMetadata("Muster","030")]
public sealed class NonShared1 : INPCBase, INonShared
{
public NonShared1()
{
Debug.WriteLine("ctor NonShared1" + this.GetHashCode().ToString());
}
#region Implementation of INonShared
public string Displayname
{
get { return "Muster 030 "+ this.GetHashCode().ToString();
}
}
#endregion
}
Run Code Online (Sandbox Code Playgroud)
现在我的问题:当Open()执行时,是否应该始终创建一个新的NonShared1实例?我总是一样的.
我的旧Plone 2站点托管在一个免费的plone提供商(比如myoldsite.hostingxyz.com)上.我在新域上有一个新站点(比如www.mysitexyz.com),并希望将旧站点重定向到新域(真正的HTTP 301重定向).
这就是我现在所拥有的:
Index,其中包含: container.REQUEST.RESPONSE.redirect('http://www.mysitexyz.com',301)
Run Code Online (Sandbox Code Playgroud)
myoldsite.hostingxyz.com/Index我有一个很好的重定向到我的新域.有没有办法说Zope/Plone我的索引脚本是我网站的默认页面?谢谢 !