我正在尝试学习消息传递系统.我发现RabbitMq和NServiceBus在很少的地方一起使用.我的问题是
在支持基于微服务的体系结构中进行版本控制的最佳实践是什么,在运行时支持同一服务的多个版本化部署以及消费者如何能够使用不同的版本?1)如果我们使用基于路由的版本控制作为这里提到的方法之一, 那么我想我们会有以下缺点
向消费者公开版本信息是最佳做法吗?
无论如何,我认为,以下内容始终适用:
什么样的微服务版本控制策略可以帮助我们实现上述目标?
注意 - 如果需要分成多个问题,请随时告诉我.
如何防止类似于下面的代码放置的Adsense响应单元突破面板?根据我的经验,横幅打破了面板并占据了全宽.用于Adsense响应单元的代码是Google提供的默认代码.
<div class="col-md-12" style="padding-top:20px;">
<div class="panel panel-default panel-profile m-b-md">
<div class="panel-body text-center" style="padding: 5px 0 5px 0">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Thank You -->
<ins class="adsbygoogle"
style="display:block;"
data-ad-client="ca-pub-xxxxxx"
data-ad-slot="xxxxxx"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
在Logout不工作后,我正在使用IdenetityServer4并重定向到MVC客户端.以下是我的MVC客户端控制器注销操作:
public async Task Logout()
{
await HttpContext.Authentication.SignOutAsync("Cookies");
await HttpContext.Authentication.SignOutAsync("oidc");
}
Run Code Online (Sandbox Code Playgroud)
以下是身份服务器4主机配置文件.
public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
// other clients omitted...
// OpenID Connect implicit flow client (MVC)
new Client
{
ClientId = "mvc",
ClientName = "MVC Client",
AllowedGrantTypes = GrantTypes.Implicit,
// where to redirect to after login
RedirectUris = { "http://localhost:58422/signin-oidc" },
// where to redirect to after logout
PostLogoutRedirectUris = { "http://localhost:58422/signout-callback-oidc" },
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile
}
}
};
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个类来处理.net核心类库中的内存缓存.如果我不使用核心,那么我可以写
using System.Runtime.Caching;
using System.Collections.Concurrent;
namespace n{
public class MyCache
{
readonly MemoryCache _cache;
readonly Func<CacheItemPolicy> _cachePolicy;
static readonly ConcurrentDictionary<string, object> _theLock = new ConcurrentDictionary<string, object>();
public MyCache(){
_cache = MemoryCache.Default;
_cachePolicy = () => new CacheItemPolicy
{
SlidingExpiration = TimeSpan.FromMinutes(15),
RemovedCallback = x =>
{
object o;
_theLock.TryRemove(x.CacheItem.Key, out o);
}
};
}
public void Save(string idstring, object value){
lock (_locks.GetOrAdd(idstring, _ => new object()))
{
_cache.Add(idstring, value, _cachePolicy.Invoke());
}
....
}
}
}
Run Code Online (Sandbox Code Playgroud)
在.Net核心中,我找不到System.Runtime.Cache.在读取.net核心内存缓存后,我添加了参考Microsoft.Extensions.Caching.Memory(1.1.0)并尝试过
using System.Collections.Concurrent; …Run Code Online (Sandbox Code Playgroud) 我正在从VB.net转换为C#.Net.
我需要更换Session("something")或Session("Others")以Session["something"]或Session["Others"]整个项目.我需要在查找框中使用什么正则表达式以及替换框中的内容.任何帮助,将不胜感激.
脚步
请查看dotnet包以获取更多详细信息
dotnet build /p:SourceLinkCreate=true -v:n -c:Release -p:ci=true
dotnet pack -v:n -c=Release --no-build --include-source --include-symbols --output .\bin
Run Code Online (Sandbox Code Playgroud)
结果:未创建包
如果你添加任何其他依赖项,它可以工作,而不是xunit,例如NUnit和测试框架,或Newtonsoft.Json.我也尝试过使用msbuild命令,结果相同
我有什么遗漏,或者这是一个错误?
我正在编写一个测试,以使用Microsoft.AspNetCore.TestHost从身份server4获取令牌
var hostBuilder = new WebHostBuilder()
.ConfigureServices(services =>
{
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients())
.AddTestUsers(Config.GetUsers())
;
})
.Configure(app =>
{
app.UseIdentityServer();
});
var server = new TestServer(hostBuilder);
var client = server.CreateClient();
client.BaseAddress = new Uri("http://localhost:5000");
var disco = await DiscoveryClient.GetAsync("http://localhost:5000");
Run Code Online (Sandbox Code Playgroud)
然后disco.Error出现以下错误
连接到 http:// localhost:5001/.well-known/openid-configuration时出错:发送请求时出错.
我错过了什么?
unit-testing asp.net-core identityserver4 asp.net-core-testhost
我正在尝试从App.Config中读取应用程序名称。这是net461控制台应用程序。我已经添加了Serilog.Settings.AppSettings包。并且还在App.Config上添加了以下serilog配置
<add key="serilog:properties:Application" value="My App"/>
<add key="serilog:minimum-level" value="Debug" />
<add key="serilog:minimum-level:override:Microsoft" value="Debug" />
<add key="serilog:enrich:FromLogContext"/>
<add key="serilog:enrich:WithMachineName"/>
<add key="serilog:enrich:WithProcessId"/>
<add key="serilog:using:Seq" value="Serilog.Sinks.Seq"/>
<add key="serilog:write-to:Seq.serverUrl" value="http://localhost:5341" />
<add key="serilog:using:Console" value="Serilog.Sinks.Console" />
<add key="serilog:write-to:Console"/>
Run Code Online (Sandbox Code Playgroud)
但是应用程序名称未显示在Seq上。但是,我appsettings.json为.netcore2项目添加了以下设置,该设置可以正常工作
"Serilog": {
"Properties": {
"Application": "Another app"
}
}
Run Code Online (Sandbox Code Playgroud)
缺什么?
量化域模型的整体值 (1) 已被检查以确保它们是可识别的值,可能已被域模型进一步编辑以使其适用,并已回显 (4) 给用户。所有这些检查都是在入境时立即进行的。然而,有一类检查应该推迟到最后可能的时刻。
在信息完整性的检查模式语言中, Ward Cunningham 解决了整个对象的延迟验证 (6)。但这对我来说仍然不完全清楚:(
我知道延迟验证是对复杂对象的非常详细的验证。那么,在遵循 DDD 时,我应该在测试方法中还是在域属性中使用此验证?这可以为 UI 实现吗?
还有我什么时候应该避免这种情况?延迟验证的缺点是什么?任何人都可以用一个例子来解释这个吗?提前致谢
c# validation design-patterns domain-driven-design domain-model
.net ×1
.net-core ×1
adsense ×1
apache-kafka ×1
appsettings ×1
architecture ×1
asp.net-core ×1
c# ×1
caching ×1
css ×1
css3 ×1
domain-model ×1
dotnet-cli ×1
find ×1
memorycache ×1
msbuild ×1
nservicebus ×1
rabbitmq ×1
regex ×1
replace ×1
serilog ×1
soa ×1
unit-testing ×1
validation ×1
versioning ×1
xunit ×1