NetCore问题集锦

1、测试没问题,上线一个功能老是报错

A second operation started on this context before a previous operation completed. This is usually caused by different threads using the same instance of DbContext.....

解决:检查代码是不是哪个异步方法调用遗漏了await关键字

2、部署在IIS支持RestfuL风格接口

配置文件添加如下代码:

<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
    <security>
    <requestFiltering>
        <verbs allowUnlisted="false">
            <add verb="GET" allowed="true" />
            <add verb="POST" allowed="true" />
            <add verb="DELETE" allowed="true" />
            <add verb="PUT" allowed="true" />
            <add verb="OPTIONS" allowed="true" />
            <add verb="UPDATE" allowed="true" />
        </verbs>
    </requestFiltering>
   </security>
    <modules>
       <remove name="WebDAVModule" />
    </modules>
      ...........
    </system.webServer>
  </location>
</configuration>

 2、今天遇到奇怪问题,AutoMapper一个字段无法映射,最后发现是同事重复注册了映射(一模一样的映射规则重复注册也会引起这样的问题,真奇怪)

原文地址:https://www.cnblogs.com/come-on-come-on/p/12410317.html