From ecebb28b60d49eeac50dfa3c9a812a0a221e55ae Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 13 十月 2023 16:07:49 +0800
Subject: [PATCH] 1.通用基础资料:增加模具检验项目、保养项目下拉接口 2.模具管理:点检项目、点检标准、保养项目、保养标准、导入接口
---
VueWebCoreApi/Startup.cs | 33 ++++++++++++++++++++++++++++++---
1 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/VueWebCoreApi/Startup.cs b/VueWebCoreApi/Startup.cs
index 9113269..c149a4c 100644
--- a/VueWebCoreApi/Startup.cs
+++ b/VueWebCoreApi/Startup.cs
@@ -10,6 +10,7 @@
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Authorization;
+using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -99,7 +100,7 @@
});
//设置SignalR
services.AddSignalR();
-
+
//设置session,并设置超时时间
services.AddSession(o =>
@@ -110,7 +111,6 @@
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
}
-
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLeftTime, ILoggerFactory loggerFactory)
{
@@ -122,6 +122,7 @@
{
DataOperator.SetConnectionString1(Convert.ToString(AppSetting.GetAppSetting("DBServer")));
});
+
#region Swagger分组第二种
app.UseSwagger();
app.UseSwaggerUI(c =>
@@ -140,6 +141,17 @@
app.UseRouting();
app.UseAuthorization();
+ //添加静态文件中间件
+ app.UseDefaultFiles();
+ //添加授权文件
+ app.UseStaticFiles(new StaticFileOptions()
+ {
+ ContentTypeProvider = new FileExtensionContentTypeProvider()
+ {
+ Mappings = { [".xls"] = "application/vnd.ms-excel" }
+ }
+ });
+ app.UseStaticFiles();
//跨域
app.UseCors("cors");
//用户session服务
@@ -150,12 +162,27 @@
app.UseStaticHostEnviroment();
//Quartz
app.UseQuartz(env).UseStaticHttpContext();
+ //配置Excel下载
+ //app.UseStaticFiles(
+ // new StaticFileOptions
+ // {
+ // //设置不限制content-type
+ // ServeUnknownFileTypes = true
+ // });
+ //app.UseStaticFiles(new StaticFileOptions()
+ //{
+ // ContentTypeProvider = new FileExtensionContentTypeProvider()
+ // {
+ // Mappings = { [".exe"] = "application/octect-stream" }
+ // }
+ //});
+
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapHub<ChatHub>("/ChatHub", options =>
{
- options.Transports =
+ options.Transports =
HttpTransportType.WebSockets |
HttpTransportType.LongPolling;
});
--
Gitblit v1.9.3