我已使用 Docker Compose 将我的多容器 Web 应用程序部署到 Azure。一个用于 Web 应用程序本身的容器和一个用于数据库的容器。该应用程序每 5 分钟运行一次作业。从日志中我可以看到该应用程序一直工作到今晚凌晨 2 点,然后它被停止并显示以下消息:
Stoping site <site> because it exceeded swap usage limits
Run Code Online (Sandbox Code Playgroud)
我真的不明白什么是交换使用限制以及应用程序停止的原因。当我再次连接到应用程序时,我发现容器是从头开始重新创建的:数据库是空的。我怎样才能找出问题所在?
I have the asp.net core MVC project and separate WebApi project in one solution. I'm adding the swagger following the documentation on github. Here is my Startup.cs of mvc project:
public void ConfigureServices(IServiceCollection services)
{
//...
// Adding controllers from WebApi:
var controllerAssembly = Assembly.Load(new AssemblyName("WebApi"));
services.AddMvc(o =>
{
o.Filters.Add<GlobalExceptionFilter>();
o.Filters.Add<GlobalLoggingFilter>();
})
.AddApplicationPart(controllerAssembly)
.AddJsonOptions(options =>
{
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
});
services.AddSwaggerGen(c =>
{
//The generated Swagger JSON file will have these properties.
c.SwaggerDoc("v1", new Info
{
Title = "Swagger XML …Run Code Online (Sandbox Code Playgroud) 我正在尝试按照这篇文章从剪贴板中的 javascript 获取图像:https : //stackoverflow.com/a/6338207/6188783
document.onpaste = function (event) {
console.log("paste triggered!");
console.log("text: " + event.clipboardData.getData("text")); // shows text if it was pasted
console.log("image: " + event.clipboardData.getData("image")); // always returns empty string p.s. I've also tried image/bmp and other formats
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
console.log(JSON.stringify(items)); // will give you the mime types
for (index in items) {
var item = items[index];
if (item.kind === 'file') {
var blob = item.getAsFile();
var reader = new FileReader();
reader.onload = …Run Code Online (Sandbox Code Playgroud) 这个问题很常见,但我还是不明白如何正确更新相关实体?
我有以下代码:
public async Task<bool> UpdateStepAssignedToLevelAsync(Step step, Guid levelId, int priority = -1)
{
var item = await this._context.StepLevels
.Include(sl => sl.Step)
.FirstOrDefaultAsync(x => x.StepId == step.Id && x.LevelId == levelId);
if (item == null)
{
return false;
}
//this._context.Entry(item).State = EntityState.Detached;
if (priority > -1)
{
item.Priority = priority;
}
item.Step = step;
//this._context.StepLevels.Update(item);
var rows = await this._context.SaveChangesAsync();
return rows > 0;
}
Run Code Online (Sandbox Code Playgroud)
当它运行时,我收到以下错误:
InvalidOperationException: The instance of entity type 'Step' cannot be tracked because another instance with …Run Code Online (Sandbox Code Playgroud) 我正在尝试将打字稿添加到我的react/redux 项目中。这是我的切片:
import { createSlice, createAsyncThunk, AnyAction, CaseReducer, PayloadAction } from '@reduxjs/toolkit';
export interface RequestStateBase {
failed: boolean;
executing: boolean;
initialLoad: boolean;
message: string | null;
errors: any[]
}
const handlePending = (state: RequestStateBase) => {
state.failed = false;
state.executing = true;
state.message = '';
}
const createCharacter = createAsyncThunk(
'character/new',
async (model: any) => characterClient.createCharacter(model)
);
const characterSlice = createSlice({
name: "character",
initialState: initialState,
reducers: {
cleanCharacterData: (state: CharacterState) => {
//...
},
//...
},
extraReducers: builder => { …Run Code Online (Sandbox Code Playgroud) 我试图将一个对象从客户端传递到集线器:在客户端上:
connection.invoke('MyMethod', {
i: 1,
a: 25
});
Run Code Online (Sandbox Code Playgroud)
在集线器上:
public async Task MyMethod(TestModel model)
{
// logic
}
Run Code Online (Sandbox Code Playgroud)
模型:
public class TestModel
{
[JsonProperty("i")]
public double Min {get;set;}
[JsonProperty("a")]
public double Max {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
在 MyMethod 中,模型不为 null,但值始终为 0。
我做错了什么?
c# ×3
asp.net-core ×2
javascript ×2
azure ×1
clipboard ×1
docker ×1
one-to-many ×1
redux ×1
signalr ×1
sql-update ×1
swagger ×1
typescript ×1