小编INN*_*VTV的帖子

在ASP.NET 4.5和5.0项目的VSTS版本管理中使用配置变量

我已经设置了3个环境(Debug,Stage&Production),并为我的Visual Studio Team Service项目testVariableRELEASE选项卡中的每个环境创建了一个自定义变量,如下所示:

在此输入图像描述

我还有一个名为testReleaseVariable所有环境共享的发布变量,如下所示:

在此输入图像描述

我找不到任何关于如何在VS中设置ASP.NET项目以在本地开发时使用这些变量以及部署构建时可以由Release Manager注入的文档.

我有ASP.NET 4.5以及ASP.NET 5.0项目.我的问题是:设置我的Web.Config(用于ASP.NET 4.5项目)或我的Config.json(用于ASP.NET 5项目)的最佳实践什么,以便同时使用环境发布配置变量在VSTS发布管理中.

c# asp.net ms-release-management azure-devops

4
推荐指数
1
解决办法
4202
查看次数

依赖注入中的 Blazor(服务器)作用域对象创建多个实例

为了演示目的,假设我有一个名为 StateManager 的类:

public class StateManager
{
    public StateManager()
    {
        IsRunning = false;
    }

    public void Initialize()
    {
        Id = Guid.NewGuid().ToString();
        IsRunning = true;
        KeepSession();
    }

    public void Dispose()
    {
        Id = null;
        IsRunning = false;
    }

    public string Id { get; private set; }
    public bool IsRunning { get; private set; }

    private async void KeepSession()
    {
        while(IsRunning)
        {
            Console.WriteLine($"{Id} checking in...");
            await Task.Delay(5000); 
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

它有一个在启动后运行的方法,每 5 秒将其 Id 写入控制台。

在我的 Startup 类中,我将其添加为范围服务:

services.AddScoped<StateManager>();
Run Code Online (Sandbox Code Playgroud)

也许我使用了错误的位置,但在我的MainLayout.razor文件中,我在OnInitializedAsync() …

.net c# asp.net-core blazor blazor-server-side

4
推荐指数
1
解决办法
2988
查看次数

服务结构服务远程处理

在过去的几周里,我一直在从云服务迁移到Service Fabric,并且使用两个服务之间的Remoting遇到了一些绊脚石.

我一直在使用Service Remoting上的官方文档和示例代码,特别是我试图让这里概述的示例工作:

https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting

我有2项服务.一个名为"RemoteService",另一个名为"CallerService".两者都源自默认的无状态服务项目.

"RemoteService""CallerService"项目中,我添加了以下接口来描述它们之间的服务契约:

public interface IMyService : IService
{
    Task<string> HelloNameAsync(string name);
}
Run Code Online (Sandbox Code Playgroud)

"RemoteService"中,我在RemoteService类中创建了asociated方法

public Task<string> HelloNameAsync(string name)
{
    return Task.FromResult("Hello " + name + "!");
}
Run Code Online (Sandbox Code Playgroud)

我还使用以下内容覆盖CreateServiceInstanceListeners

protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
    return new[] { new ServiceInstanceListener(context => this.CreateServiceRemotingListener(context)) };
}
Run Code Online (Sandbox Code Playgroud)

在我的"CallerService"中,当我尝试连接时,使用以下内容调用"RemoteService":

IMyService helloNameClient = ServiceProxy.Create<IMyService>(new Uri("fabric:/Application/RemoteService"));
string message = await helloNameClient.HelloNameAsync("Luke");
Run Code Online (Sandbox Code Playgroud)

我得到了这个例外

InnerException = {"Interface id '1994370306' is not implemented by …
Run Code Online (Sandbox Code Playgroud)

c# azure azure-service-fabric

3
推荐指数
1
解决办法
3282
查看次数

WCF背后的ImageResizing.Net

我一直在评估Nathanael Jones 令人惊叹的成像库和插件,用于我公司在Azure上构建的一些图像处理服务.在获得许可证之前,我们会对它们进行全面测试,以确保它们符合我们的方案.帮自己一个忙,在这里检查一下.

在ASP.NET MVC Web应用程序中使用插件时,我在插件方面取得了巨大成功.我正在使用我在UI中发布的Controller中的图像服务器功能.裁剪,调整大小和简单/高级过滤器正在按预期工作.

我遇到的问题是当我将此功能作为该应用程序中的类库移动到WCF服务时.裁剪和调整大小的工作完全符合预期,但所有过滤指令(亮度,对比度,棕褐色等)都被忽略或无声地失败.这是图像处理代码:

var instructions = new ImageResizer.Instructions();

//All of these instructions work
instructions.Width = 300;
instructions.Height = 300;
instructions.Mode = ImageResizer.FitMode.Crop;
instructions.OutputFormat = ImageResizer.OutputFormat.Jpeg;
instructions.JpegQuality = 90;  
double[] cropCoordinates = {0,100,0,100};
instructions.CropRectangle = cropCoordinates;       
instructions.Mode = ImageResizer.FitMode.Crop;

//These instructions are ignored, or fail silently
instructions.Invert = true;
instructions.Saturation = -1;
instructions.Sepia = true;

var imageJob = new ImageResizer.ImageJob();

imageJob.Instructions  = instructions;
imageJob.Source = bmpSource;
imageJob.Dest = typeof(Bitmap);

imageJob.Build(); 
Run Code Online (Sandbox Code Playgroud)

我已经将我的MVC应用程序使用的Web.Config设置复制到使用ImageResizing包(来自Nuget)的类库的App.Config.

<configuration>
    <configSections>
        <section …
Run Code Online (Sandbox Code Playgroud)

c# asp.net wcf image-resizing imageresizer

0
推荐指数
1
解决办法
287
查看次数