非常感谢这里的任何帮助.
关于场景的简要说明 -
在服务器上运行COM +(用C#编写).此COM的任务是获取文件名,多页tiff文件的页码以及将其转换为gif文件图像的分辨率.使用代理从Web应用程序调用此COM.网站获取转换后的图像并以请求的分辨率显示.对于打印 - 它提出2个请求 - 第一个用于显示分辨率,第二个用于全分辨率(使用window.print()打印).
问题 -
有些时候服务器内存不足并且网站上没有显示图像.需要定期重启服务器.
错误
EventType clr20r3, P1 imageCOM.exe, P2 1.0.0.0, P3 4fd65854, P4 prod.web.imaging, P5 1.0.0.0, P6 4fd65853, P7 1a, P8 21, P9 system.outofmemoryexception, P10 NIL.
Here is the error(s) on the web server (these continuously appear every minute) ….
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at …Run Code Online (Sandbox Code Playgroud) 如何遍历Object类型的List?
List<object> countries = new List<object>();
countries.Add(new { Name = "United States", Abbr = "US" , Currency = "$"});
countries.Add(new { Name = "Canada", Abbr = "CA", Currency = "$" });
...more
Run Code Online (Sandbox Code Playgroud)
我想在我的视图中做一些事情(使用属性名称)
@model ViewModel
@foreach(object country in Model.Countries)
{
Name = country.Name
Code = country.Abbr
Currency = country.Currency
}
Run Code Online (Sandbox Code Playgroud)
更新:忘了提到我正在使用MVC,我想在View中循环数据.States对象是ViewModel要查看的强类型属性之一.
更新:按要求更新以显示如何从控制器调用View -
[HttpPost]
public ActionResult Index(FormCollection form)
{
..some validations and some logic
ViewModel myViewModel = new ViewModel();
myViewModel.Countries = GetCountries(); -- this is where data get initialized
myViewModel.Data …Run Code Online (Sandbox Code Playgroud) 我有一个从代理使用的 COM+ 服务器(项目输出 dll)(我猜这称为客户端应用程序并在 dllhost.exe 下运行)。COM+ 服务器通过本身作为服务运行的服务器控制台应用程序(项目输出 exe)运行。
我需要读取 COM+ 服务器 (dll) 中的配置文件。我不知道
我在这里找到了这个链接,但我不知道该怎么做。谢谢
任何人都可以在这里提出错误的建议吗?
public class Student
{
public List<Class> Classes { get; set; }
public Student(List<Class> classes)
{
this.Classes = classes;
}
public Student(Class class)
{
//This does not work
//Error: Object reference not set to an instance of an object.
this.Classes.Add(class);
}
}
Run Code Online (Sandbox Code Playgroud)
将其称为以下作品
var classes = new List<Classes>();
classes.Add(new Class("English", "Elective"));
classes.Add(new Class("Math", "Core"));
..more classes to add
Student student = new Student(classes);
Run Code Online (Sandbox Code Playgroud)
当我这样打电话时(只需要添加一个课程)
Student student = new Student(new Class("Masters","Accounts"));
Run Code Online (Sandbox Code Playgroud)
我收到错误.谢谢.