0%

.Net Core Abp 环境安装

1. 下载.Net Core安装包

.Net Core 3.1安装地址

  • .Net Core SDK 3.1用于代码开发
  • Hosting Bundle用于在IIS上发布

安装完然Bundle后, 需要重启iis服务

1
2
net stop was /y
net start w3svc

发布网站时,应用池标识要设置为LocalSystem

2. 发布注意项

发布时,若swagger出现500,大多数是xml没有生成

1
2
3
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

需要在项目csproj文件的<PropertyGroup>标签中,添加:
1
<GenerateDocumentationFile>true</GenerateDocumentationFile>

2.1 在IIS上调试

修改web.config 中的aspNetCore的arguments为调试生成的路径

1
<aspNetCore processPath="dotnet" arguments="bin\Debug\netcoreapp2.2\MPACore.PhoneBook.Web.Mvc.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">

2.2 处理 不支持RESTful的问题

1
2
3
4
5
6
7
8
9
<!--支持RESTful,PUT,DELET,POST,GET请求 begin-->
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<!--支持RESTful,PUT,DELET,POST,GET请求 end-->

3. abp添加实体步骤

  1. 添加迁移文件
    1
    add-migration <迁移名称>
  2. 更新数据库
    1
    update-database
  3. 多个数据库上下文迁移
    需要指定迁移哪个数据库上下文 xxxDbContext
    add-migration "标识" -Context xxxDbContext
    update-database -Context xxxDbContext