在MongoDB nuget包上使用ELMAH 配置日志到MongoDB后,它成功登录到MongoDB集合,但在尝试访问Web界面时,它给出了以下异常:
命令'create'失败:集合'collectionname'已经存在(响应:{"note":"autoIndexId选项已弃用,将在以后的版本中删除","ok":0.0,"errmsg":"一个集合'collectionname'已存在","code":48,"codeName":"NamespaceExists"})
我不知道为什么每次尝试为elmah创建web配置配置集合时:
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.FallbackErrorLogSectionHandler, Elmah.FallbackErrorLog" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
<!--<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />-->
</sectionGroup>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
</system.webServer>
<elmah>
<security allowRemoteAccess="true" />
<errorLog type="Elmah.FallbackErrorLog, Elmah.FallbackErrorLog">
<add type="Elmah.MongoErrorLog, Elmah.MongoDB" connectionStringName="elmah-mongodb" /> …Run Code Online (Sandbox Code Playgroud)