我正在构建服务结构应用程序.当我创建一个项目并运行它工作正常.但是当我在Api控制器中注入一个服务时,它给了我这个错误,我试图解决它,但还没有成功.
System.BadImageFormatException无法加载文件或程序集"dotnet-aspnet-codegenerator-design"或其依赖项之一.尝试加载格式不正确的程序.
我添加了这项服务
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new ServiceInstanceListener[]
{
new ServiceInstanceListener(serviceContext =>
new KestrelCommunicationListener(serviceContext, "ServiceEndpoint", (url, listener) =>
{
ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting Kestrel on {url}");
return new WebHostBuilder()
.UseKestrel()
.ConfigureServices(
services => services
.AddSingleton<StatelessServiceContext>(serviceContext)
.AddScoped(typeof(ISendMessage), typeof(SendMessage))
)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)
.UseUrls(url)
.Build();
}))
};
}
Run Code Online (Sandbox Code Playgroud) azure azure-service-fabric asp.net-core service-fabric-stateless
我正在使用 Azure function app v3,我想将详细信息记录到 Application Insights 中。函数应用程序中默认有 ILogger。Ilogger和TelemetryClient将详细信息记录到 App Insights 之间有什么区别。记录详细信息的最佳方式是什么?
任何回复表示赞赏,提前致谢。
要访问DocumentDB/CosmosDB,我正在使用包Microsoft.Azure.DocumentDB.Core(v1.3.2).当我创建并初始化DocumentClient类时,我注意到了:
var documentClient = new DocumentClient(new Uri(endpointUrl), primaryKey);
await documentClient.OpenAsync();
Run Code Online (Sandbox Code Playgroud)
向端点发出了许多请求以获取有关索引和其他信息的信息.确切地说,有9个HTTP请求正在进行中.OpenAsync().这使得客户端的创建和激活在性能方面成本非常高 - 需要一秒钟才能将所有请求带回家.
因此,为了减轻这种代价高昂的操作,我正在制作DocumentClient一个单例,并在应用程序的生命周期内保持参考.
应用程序是Asp.Net Core MVC,这可能会将此对象的引用保留在内存中数天.
问题:可以将此对象保持为单例吗?如果不是,应该采取什么策略来处置它?或者有没有办法使初始化更便宜(即不要做出这些初始请求?).
我目前使用Azure Application Insights登录我的所有Web API和MVC应用程序.显然,这种记录的大部分是自动的,这很好.对于我手动想要捕获的事件,我已经实现了一个"LoggingUtility",其中包含"LogError"和"LogInformation"等方法,它们只调用Trace.TraceError和Trace.TraceInformation(以为可以在一个实例中更改日志记录的实现)放在未来).然后,Application Insights将捕获Trace.
我已经开始在Azure Service Fabric中开发一些有状态服务,但似乎无法找到使用Application Insights的方法.我偶然发现了一些文章,指向我正在预发布的NuGet包,但现在已被删除(https://www.nuget.org/packages/Microsoft.ServiceFabric.Telemetry.ApplicationInsights/).
当然,Service Fabric模板会生成"ServiceEventSource",但首先我看不出这对Application Insights有用,理想情况下我希望通过"LoggingUtility"类完成所有日志记录.
是否可以将Application Insights集成到Service Fabric中?如果是这样,我可以继续使用Trace(通过我的"LoggingUtility"类)吗?
实际上,我在我的asp.net web API 2中设置了应用程序见解,以便按照使用Application Insights诊断Web应用程序中的异常的步骤记录错误,一切正常,但是,我想为每个异常添加信息,例如,CustomerId,JobId等.
因此,我希望通过Azure Application Insights在异常(调用堆栈或其他属性)中查看该数据(请参阅此图像).该信息可以帮助我检测我应该用来尝试复制错误场景的记录.
你能告诉我任何建议吗?
谢谢!
当我运行以下示例时,它抛出以下异常......
附加信息:实体'TestEntity'没有定义密钥.
我使用代码第一个实体上下文配置了密钥...
modelBuilder.Entity<TestEntity>().HasKey(t => t.EntityID);
有什么问题?为什么OData V4没有使用配置的密钥?
namespace WebApplication2
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.MapODataServiceRoute("odata", "odata", model: GetEDMModel());
}
private static IEdmModel GetEDMModel()
{
ODataModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<TestEntity>("TestEntities");
return builder.GetEdmModel();
}
}
public class TestEntity
{
public int EntityID { get; set; }
public string Name …Run Code Online (Sandbox Code Playgroud) 这是一个很长的问题,有一些权衡取舍,我敢肯定.在这个文档区域:
不能给我足够自信地回答上面的问题.
因此,他们说:"Azure应用程序网关(AG)尝试再次解析服务地址,并在无法访问服务时重试该请求".
我知道Service Fabric Reverse Proxy(RP)是如何通过封装解析循环来实现这一点的.AG也有此功能吗?无论如何,AG也是一个反向代理.
因此,对于进入SF群集的外部流量至关重要,为什么我会使用另一个(我知道RP也允许群集内通信,这是一个很好的选择).
reverse-proxy azure azure-service-fabric azure-application-gateway
我有一个与 Application Insights 链接的 Azure Function。我在 AppInsights 中登录了多个业务数据,并且可以在短时间内运行我的函数的大量实例。
我阅读了AppInsights 中的数据采样文档,我想知道:我会因为这种数据采样算法而丢失数据吗?
问题:本地 SQL Server 中存储/生成的数据需要记录到应用程序洞察中。该数据既代表传递给存储过程的临时数据,也代表存储在表中的具体数据。我问这个问题是为了弄清楚是否有任何直接的方法可以做到这一点。到目前为止,我已经提出了以下选项,如果没有直接的解决方案,请告诉我哪个是最适合该任务的选项。
选项: