开发环境
Visual Studio 2022
安装了.Net6+ SDK
数据库:Microsoft SqlServer 2012+ 或 MySQL 5.6+ 或 SQLite3
打开appsettings.json进行修改:
//数据库连接配置,请实际情况修改数据库连接字符串(ConnectionString)
"DatabaseInfo": {
//默认配置
"Default": {
"DbType": "MySql",
"DatabaseVersion": "5.7.28-mysql",
"ConnectionString": "server=192.168.0.1;port=3306;database=dbname;userid=root;password=123456;CharSet=utf8mb4;pooling=true;"
}
//集群配置(读写分离)
//,"Clustered": [
// {
// "ProviderKey": "clustered1",
// "DbType": "Mysql",
// "DatabaseVersion": "5.7.28-mysql",
// "ConnectionString": "server=192.168.0.1;port=3306;database=dbname;userid=root;password=123456;CharSet=utf8mb4;pooling=true;"
// }
//]
}
//系统配置(应用程序相关一些配置)
"SystemInfo": {
//静态文件路径
"StaticFilePath": "D:\\wwwroot\\content",
//超级管理员列表
"SuperManager": [ "test" ],
//是否启用访问日志
"IsUseDbLogVisit": false,
//密码md5加盐处理
"SaltPassword": "6633dd88wewererterth",
//是否运行时编译
"IsRuntimeCompilation": false,
//超时设置
"ManageTimeoutSeconds": null
}
//分布式缓存配置(Redis配置)
"RedisInfo": {
"Default": {
"DatabaseIndex": 0,
"ConnectionString": "localhost:6379,password=123456",
"IsOnlyOnceConnect": true,
"IsSubScribeConnect": false
}
//集群配置
//,"Clustered": [
// {
// "ProviderKey": "clustered1",
// "DatabaseIndex": 0,
// "IsOnlyOnceConnect": true,
// "ConnectionString": "localhost:6380,password=123456"
// }
//]
}
//本地上传配置
"LocalUploadInfo": {
//本地文件访问路径
"LocalFileUrl": "http://localhost:188/api/File/Get",
//本地文件存储路径
"LocalFilePath": "D:\\work\\web\\wwwroot\\Upload"
}
//限制文件类型及大小
"AllowUploadFiles": [
{"Type": "txt","Size": 1048576},
{"Type": "png,gif,jpg,jpeg","Size": 1048576},
{"Type": "doc,docx,xls,xlsx","Size": 1048576},
{"Type": "mp3,mp4","Size": 10485760},
{"Type": "zip,rar,7z","Size": -1}
]
//该节点为WebApi及Swagger文档说明配置信息
"WebapiInfo": {
"SwaggerVersion": "v1.0",
"SwaggerTitle": "商家接口",
//默认None(None,List,Full)
"SwaggerDocExpansion": "None",
//当前系统文档注释
"SwaggerXmlPath": "\\bin\\net6.0\\Util6.Business.SystemicWeb.XML",
//其他注释文件路径
"SwaggerXmlList": [ "\\bin\\net6.0\\Util.Common.XML", "\\bin\\net6.0\\Util6.Contents.XML", "\\bin\\net6.0\\Util6.Contents.WebUI.XML"],
////线上当前系统文档注释
//"SwaggerXmlPath": "\\Util6.Business.SystemicWeb.XML",
////线上其他注释文件路径
//"SwaggerXmlList": [ "\\Util.Common.XML", "\\bin\\Util6.Contents.XML", "\\bin\\Util6.Contents.WebUI.XML"],
//通用操作参数
"OperParameters": [
{
"Name": "Token",
"Description": "凭证",
"Required": false,
//"In": "Query"
"In": "Header"
}
],
//接口通用操作参数忽略路径
"ApiOperParameterIgnoreUrls": [
"/api/User/Login",
"/api/File/Get",
"/api/Swagger",
"/swagger/index.html"
]
}
运行项目
1.设置”Util6.Business.SystemicWeb”项目为启动项目。
2.然后按F6生成解决方案,等待解决方案生成完成:
3.按下来就可以按Ctrl+F5或者F5运行项目了