cors
This commit is contained in:
parent
2e35df01c7
commit
73b3eea1c3
@ -94,7 +94,6 @@ namespace linesider_screen_bankend.Controller
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
// 返回成功响应
|
// 返回成功响应
|
||||||
await this.HttpContext.SendApiFailAsync(500, "工单不在数据库");
|
await this.HttpContext.SendApiFailAsync(500, "工单不在数据库");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,11 @@ namespace linesider_screen_bankend.Views
|
|||||||
var server = new WebServer(o => o
|
var server = new WebServer(o => o
|
||||||
.WithUrlPrefix(url)
|
.WithUrlPrefix(url)
|
||||||
.WithMode(HttpListenerMode.EmbedIO))
|
.WithMode(HttpListenerMode.EmbedIO))
|
||||||
|
.WithCors(
|
||||||
|
origins: "*", // 允许所有来源,或指定特定来源如 "http://example.com,http://localhost:8080"
|
||||||
|
headers: "*", // 允许所有头
|
||||||
|
methods: "*" // 允许所有方法
|
||||||
|
)
|
||||||
.WithWebApi("/print_api", m => m
|
.WithWebApi("/print_api", m => m
|
||||||
.WithController<PrintCommunicationController>(() => new PrintCommunicationController(AddLog))
|
.WithController<PrintCommunicationController>(() => new PrintCommunicationController(AddLog))
|
||||||
.WithController<OnlyPrintProductLabelController>(() => new OnlyPrintProductLabelController(AddLog)))
|
.WithController<OnlyPrintProductLabelController>(() => new OnlyPrintProductLabelController(AddLog)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user