Visual Studio 2010 SP1,已编译的WCF应用程序,将其放在服务器上,当然它在第一次运行时出现错误(什么是新的),将堆栈跟踪输出到日志文件.
它正在看到我的开发环境的路径.为什么?是因为我将它部署为Debug与Release相比还是还有别的东西,或者我是否应该更加谨慎地输出Stack Traces呢?
04/09/2012 03:58:46: Error: Object reference not set to an instance of an object. at App1.Logging.LogMessageToFile(String msg, Boolean isUsingClickOnceApp) in C:\Users\robcube\Documents\Visual Studio 2010\Projects\AppWebService\App1\Logging.cs:line 63
at App1.App1Main.ConnectWebService(String description) in C:\Users\robcube\Documents\Visual Studio 2010\Projects\AppWebService\App1\International.cs:line 40
04/09/2012 03:58:46: Error: Object reference not set to an instance of an object. at App1.App1Main.UpdateActivityLog(String data, String userName, Boolean deleteData, Int64 firstId, Int64 lastId, String changeType) in C:\Users\robcube\Documents\Visual Studio 2010\Projects\AppWebService\App1\App1Main.cs:line 641
Run Code Online (Sandbox Code Playgroud)
谢谢,-rob
我试图在一些单选按钮周围设置一个鲜艳的红色边框,但它没有出现在Firefox最新版或Chrome最新版中.在IE9/IE8中正常工作.
我需要的表单上的每个输入元素都有一个由MVC3放入的data-val-required属性.当我们有文本或textarea输入时,所有浏览器都会在红色边框中放入花花公子,但我正在努力使用单选按钮.对于IE,它可以工作,但其他浏览器不会在它周围放置红色边框.
CSS:
input[data-val-required], select[data-val-required], textarea[data-val-required]
{
background-color: #F0FFFF;
border: 1px solid red;
}
Run Code Online (Sandbox Code Playgroud)
视图源:
<label for="WaiveSelect">Do you waive confidentiality?</label><br />
<input data-val="true" data-val-number="The field WaiveSelect must be a number." data-val-required="Please select waive." id="WaiveSelect" name="WaiveSelect" type="radio" value="0" /> No, I do not waive confidentiality<br />
<input id="WaiveSelect_2" name="WaiveSelect" type="radio" value="2" /> Yes, I waive confidentiality<br />
<input id="WaiveSelect_3" name="WaiveSelect" type="radio" value="3" /> Yes, I waive confidentiality except to the client<br />
<span class="field-validation-valid" data-valmsg-for="WaiveSelect" data-valmsg-replace="true"></span>
Run Code Online (Sandbox Code Playgroud)
在IE中它看起来像什么(Firefox和Chrome显示没有边框):

我想通过使用类型和保持简单来使我的代码基于约定,但泛型具有自己的复杂性和它自己的学习曲线.
我在List中有一堆POCO(普通旧CLR对象),我想在代码中稍后进行迭代.
var models = new List<Type>();
models.Add(typeof(Person));
models.Add(typeof(Company));
Run Code Online (Sandbox Code Playgroud)
想循环遍历每个列表项:
models.ForEach(m =>
{
var label = m.FullName;
// var data = JsonConvert.DeserializeObject<List<typeof(m)>>(""); // doesn't work
var data = JsonConvert.DeserializeObject<List<m>>(""); // doesn't work either
...
}
Run Code Online (Sandbox Code Playgroud)
问题是反序列化行中的"m"不起作用.传递它的最佳方法是什么,即将'List <m>'设为'List <T>'我们可以使用?