小编Kli*_*ger的帖子

Common.Logging配置异常

我尝试打电话时遇到以下异常

var log = LogManager.GetLogger(this.GetType());
Run Code Online (Sandbox Code Playgroud)

Common.Logging.dll中发生了'Common.Logging.ConfigurationException'类型的第一次机会异常

Common.Logging.dll中发生了'Common.Logging.ConfigurationException'类型的无法处理的异常

附加信息:无法从配置部分'common/logging'获取Common.Logging的配置.

这是一个引用的.NET 4应用程序

  • log4net.dll
  • Common.Logging.dll
  • Common.Logging.log4net.dll

我的app.config有以下内容:

<?xml version="1.0"?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
    <configSections>
        <sectionGroup name="common">
            <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
        </sectionGroup>
    </configSections>
    <common>
        <logging>
            <factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
                <arg key="level" value="ALL" />
                <arg key="showLogName" value="true" />
                <arg key="showDataTime" value="true" />
                <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
            </factoryAdapter>
        </logging>
    </common>
</configuration>    
Run Code Online (Sandbox Code Playgroud)

我试着像这样打电话:

var log = LogManager.GetLogger(this.GetType());
log.Debug(m => m("testing"));
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

.net c# app-config exception-handling common.logging

9
推荐指数
1
解决办法
1万
查看次数

app.config中元素的顺序是否重要?

我已经看到并遇到app.config/web.config的问题,我已经更改了元素的顺序,应用程序停止了工作.我相信我通过查看machine.config并遵循其中的顺序来解决问题.

一个例子是以下问题:Common.Logging配置异常

通过更改元素在文件中的显示顺序来解决该问题.

所以,问题是,元素的顺序是否重要?

在我看来它确实如此.

如果是的话,它是否记录在任何地方,xsd架构可能?

.net app-config web-config configuration-files

9
推荐指数
1
解决办法
1948
查看次数

在SQL Server中使用游标变量的优点(声明@cn游标)

在T-SQL中,可以用两种方式声明游标(我知道):

  1. declare CursorName cursor for ...
  2. declare @CursorName cursor

我正在运行一些测试,我注意到游标变量的创建不会在结果中添加条目sp_cursor_list.

从性能,资源利用率等角度来看,使用第二种方法是否有任何优势/劣势?

PS:我知道潜在的游标性能问题.我不是要求基于游标和基于集合的比较.或者游标while与temp/table变量.

t-sql sql-server syntax cursor

7
推荐指数
2
解决办法
7920
查看次数

我们如何标记过载的方法已过时?

我有两个功能:Method(A val)Method(B val),一个了结valA和其他类型的B.

我想标记Method(A val)过时,以便IDE可以突出显示它已经过时的事实.

我已经装饰了方法[Obsolete],但是,我没有看到它被弃用.

我错过了什么吗?从我的研究中,我只看到了创建一个全新方法来替换旧方法的例子,但没有看到任何一个重载函数的例子取代了旧的已弃用的方法.任何帮助将受到高度赞赏.

.net c#

4
推荐指数
1
解决办法
330
查看次数

Kendo UI和响应式设计

Kendo UI是否适合移动设备的响应式设计?或者我应该使用bootstrap等...用于响应式移动设计?

responsive-design twitter-bootstrap kendo-ui

3
推荐指数
1
解决办法
7918
查看次数

ASP.net 核心在 src 的 img 标签中显示变量

我正在尝试使用我在控制器中设置的变量作为 img 标签内的 src。我直接复制了字符串并且它起作用了,所以我知道我的路径是正确的。但是,我无法弄清楚如何将我创建的变量放入 img 标签中。

这是我的控制器:

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace dojodachi.Controllers
{
    public class HomeController : Controller
    {
        // GET: /Home/
        [HttpGet]
        [Route("")]
        public IActionResult Index()
        {
            ViewData["Tree"] = "~/images/regular_tree.jpeg";
            return View();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的 cshtml 文件

<div id = wrapper>
    <p>Fullness:    Happiness:      Meals:     Energy</p>
    <div id = inside>
        <img src="@ViewData['Tree']" alt="Regular Tree"> //How do I place my variable in this img tag?
        <p></p>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

html c# asp.net

0
推荐指数
1
解决办法
7372
查看次数