我正在尝试使用TFS 2010设置构建.我希望构建号格式类似于$(BuildDefinitionName)_ $(version),其中$(Version)是"获取版本"中指定的版本(标签或变更集) "队列构建"对话框中的"字段".如果没有特定版本,我希望该版本是最新版本.
我用Google搜索,但我是msbuild和TFS构建的新手,所以我不确定我应该寻找什么才能开始.
谢谢.
我正在尝试使用StructureMap 2.6.1使用基于约定的注册立即注册我的所有存储库.请参阅下面的代码:
x.Scan(s =>
{
s.TheCallingAssembly();
s.IncludeNamespaceContainingType<RepositoryRegistration>();
s.SingleImplementationsOfInterface();
}
Run Code Online (Sandbox Code Playgroud)
它工作但现在我正在尝试为所有已注册的类型添加生命周期(HybridHttpOrThreadLocalScope).是否可以不从头开始重写SingleImplementationsOfInterface约定,如果是,如何?
谢谢.
我喜欢通过在配置文件中设置serviceActivations来托管没有.svc文件的服务的WCF 4.0功能.它使用默认服务工厂很好用但现在我正在尝试使用AutofaServiceHostFactory做同样的事情,所以我的依赖项将被正确注入.在我尝试的所有场景中,当我尝试访问服务时仍然遇到此错误:为WCF配置的服务"WCFAutofacWiring.MyService"未向Autofac容器注册.我在一个空的asp.net网站上托管我的服务.这是我做的:
Web.config:
<serviceHostingEnvironment>
<serviceActivations>
<add factory="Autofac.Integration.Wcf.AutofacServiceHostFactory"
relativeAddress="~/WASCurrentTime.svc"
service="WCFAutofacWiring.MyService" />
</serviceActivations>
</serviceHostingEnvironment>
Run Code Online (Sandbox Code Playgroud)
然后,我在app_code文件夹中放入一个文件来注册我的依赖关系,如Autofac文档(Autofac WcfIntegration)中所述,我向调试器确认在服务启动时调用了代码:
public static class AppStart
{
public static void AppInitialize()
{
AutofacHostFactory.Container = new AutofacBootstrapper().Configure();
}
}
Run Code Online (Sandbox Code Playgroud)
最后,这是我的注册:
public class AutofacBootstrapper
{
public IContainer Configure()
{
var builder = new ContainerBuilder();
// register types
builder.Register<ILanguageProvider>(x => new MyLanguageProvider("en-US"));
builder.RegisterType<MyService>();
return builder.Build();
}
}
Run Code Online (Sandbox Code Playgroud)
如果使用.svc文件而不是serviceActivation,我的服务可以正常工作但是如果唯一的原因是设置我可以在web.config中指定的工厂,我发现创建.svc文件会很浪费.
任何的想法 ?
谢谢
我目前正在做一个使用证书加密数据的概念验证。它运行良好,但现在,我想尝试证书过期的场景。我创建了一个过期的证书,我惊讶地注意到即使使用过期的证书,一切都可以正常工作。我期待一个错误。
你知道是不是因为它是自签名证书?
这是我用来测试我的案例的代码
[TestMethod]
public void Encrypt_decrypt_with_expired_certificate()
{
//Arrange
var baseString = "This is an encryption test";
X509Certificate2 newX509Certificate2 = new X509Certificate2("d:\\testx509certExpired.pfx", "apassword");
Console.WriteLine(newX509Certificate2.NotAfter); //Show the expiration date which is in the past
var encryptor = new CertificateEncryptor(newX509Certificate2); //This class is a simple wrapper around RSACryptoServiceProvider
//Act
string encryptedResult = encryptor.Encrypt(baseString); //Exception expected because of the expired certificate but not thrown
//Assert
Console.WriteLine("Base string : {0}", baseString);
Console.WriteLine("Encrypted string : {0}", encryptedResult);
Assert.IsNotNull(encryptedResult);
//revert back
string decryptedString = encryptor.Decrypt(encryptedResult);
Console.WriteLine("Decrypted …Run Code Online (Sandbox Code Playgroud)