小编Moh*_*yan的帖子

如何解决WCF中的System.ServiceModel.ServerTooBusyException?

我正在开发一个每天平均有 50,000 次访问(大约 140,000 页面浏览量)的网站。我正在使用WCF作为我的服务InstanceContextMode = InstanceContextMode.PerCall
此外,我正在使用异步方法来调用 WCF 服务,
最近我在某些页面和某些请求上收到以下异常消息:

Exception Type: System.ServiceModel.ServerTooBusyException
Exception Message: The HTTP service located at http://localhost:8090/SmartService.svc is unavailable.  This could be because the service is too busy or because no endpoint was found listening at the specified address. Please ensure that the address is correct and try accessing the service again later.
Stack Trace:    at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass5`1.<CreateGenericTask>b__4(IAsyncResult asyncResult)
   at …
Run Code Online (Sandbox Code Playgroud)

c# wcf exception wcf-configuration asynchronous-wcf-call

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

当ListView处于虚拟模式时,无法访问所选项集合?

我在虚拟模式下有一个ListView.我想进入SelectedItems物业.
但是当我使用时ListView1.SelectedItems,我收到以下异常:

Cannot access the selected items collection when the ListView is in virtual mode
Run Code Online (Sandbox Code Playgroud)

如何ListView1.SelectedItems在VirtualMode中访问.

c# listview selecteditem virtualmode

4
推荐指数
2
解决办法
8553
查看次数

适用于CKEditor 4.1.1的Html 5视频插件

这里有一个针对ckedior的HTML 5插件http://ckeditor.com/forums/Plugins/HTML5-Video

但不幸的是,视频插件在CKEditor 4.1.1上无法正常工作

它工作直到你没有看到源,如果你点击源并返回编辑器它写'你的浏览器不支持视频......."

你能指导我吗?

video plugins ckeditor

4
推荐指数
2
解决办法
8337
查看次数

将隐藏字段中的int列表绑定到MVC c#中的模型属性?

我们可以将以下隐藏字段绑定到List<int>MVC中的ViewModel属性吗?

<input type="hidden" name="HiddenIntList" id="HiddenIntList" value="[1,2,3,4,5,6,7]" />
Run Code Online (Sandbox Code Playgroud)

上面隐藏的字段用javascript填充.

ViewModel属性:

public List<int> HiddenIntList {get;set;}
Run Code Online (Sandbox Code Playgroud)

javascript c# asp.net-mvc-5

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

获取具有实体框架的特定ID的下一个和上一个实体?

我有一个员工表单,用于在我的项目中使用ASP.NET MVC5编辑或显示个人信息,此表单获取Id并显示员工信息.

在这种形式我必须NextPrevious按钮,允许管理员导航到下一个或前员工(如果没有员工的按钮应禁用).另一方面,此表单具有由Admin设置的变量排序.

因此,我想将两个<a />标签与下一个和上一个员工ID相关联,并将其链接到员工表单.

<< Previous employee Id by sorting             Next employee Id by sorting >>
Run Code Online (Sandbox Code Playgroud)

我知道如何获得当前的员工,这在Entity Framework中非常简单.

但是,如何通过实体框架获取当前Id的下一个和上一个ID?

c# entity-framework-6

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

未捕获的类型错误:无法读取未定义、电子 2、角度 6 的属性“fn”?

我正在使用 Angular 6.0.3、electronjs 2.0.2 和以下 package.json

{
  "name": "test",
  "version": "1.0.0",
  "license": "MIT",
  "main": "electron-main.js",
  "author": {
    "name": "Mohammad Dayyan @mdssoft",
    "email": ""
  },
  "scripts": {
    "ng": "ng",
    "start": "ng serve --open",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "electron": "electron .",
    "electron-build": "ng build --prod && electron ."
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.3",
    "@angular/cdk": "^6.1.0",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/material": "^6.1.0",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/router": …
Run Code Online (Sandbox Code Playgroud)

javascript electron angular angular6

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

像这样在WPF中向ListView添加图像......?

我将在WPF中创建一个ListView,如下图

中的WPF中的ListView http://www7.picfront.org/picture/ZcYGCAbgtG/thb/FF3-bookmark-manager.jpg
http://www.picfront.org/d/7xuv

我的意思是我想GravatarName列中添加标签旁边的图像.
如果你指导我会没事吗?

编辑:图像是方法的输出.该方法使图像来自base-64字符串.

c# wpf binding listview image

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

如何在MVC 5,C#中的PartialView控制器中使用OutputCache?

我有Controller PartialViewResultJsonResult返回类型.
我想缓存它[OutputCache],但它根本不工作,总是以下Index控制器Thread.Sleep(5000);运行!

[HttpPost]
[ValidateAntiForgeryToken]
[OutputCache(Duration = 120, Location = OutputCacheLocation.Server)]
public ActionResult Index(DevicesAjaxViewModel viewModel)
{
    try
    {
        //Response.Cache.SetExpires(DateTime.Now.AddSeconds(30));
        //Response.Cache.SetCacheability(HttpCacheability.Server);
        Response.Cache.AddValidationCallback(IsCacheValid, Request.UserAgent);
#if DEBUG
        Thread.Sleep(5000);
#endif
        if (!ModelState.IsValid) return Json(new ModelError("Error in Model"));
        var allObjects = _objectService.GetAllObjects();
        string objectName = allObjects.First(q => q.Id == viewModel.ObjectId).Name;
        KeyValuePair<int, List<DeviceModel>> keyValuePair = ApplyFiltering(objectName, viewModel.PageNumber, false, viewModel.Filtering);
        FilteringDevicesResultModel filteringDevicesResultModel = new FilteringDevicesResultModel
        {
            Devices = keyValuePair.Value,
            FoundDevicesCount = keyValuePair.Key.ToMoneyFormat(),
            RequestId = viewModel.RequestId
        };

        return PartialView("~/Views/Partials/DevicesPagePartial.cshtml", …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc outputcache

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

反应形式的数字数组,Angular 6?

我知道我们可以使用 FormArray 添加对象数组,FormGroup如下所示: https:
//alligator.io/angular/reactive-forms-formarray-dynamic-fields/

ngOnInit() {
  this.orderForm = this.formBuilder.group({
    customerName: '',
    email: '',
    items: this.formBuilder.array([ this.createItem() ])
  });
}

createItem(): FormGroup {
  return this.formBuilder.group({
    name: '',
    description: '',
    price: ''
  });
}

addItem(): void {
  this.items = this.orderForm.get('items') as FormArray;
  this.items.push(this.createItem());
}

<div formArrayName="items"
  *ngFor="let item of orderForm.get('items').controls; let i = index;">
  <div [formGroupName]="i">
    <input formControlName="name" placeholder="Item name">
    <input formControlName="description" placeholder="Item description">
    <input formControlName="price" placeholder="Item price">
  </div>

  Chosen name: {{ orderForm.controls.items.controls[i].controls.name.value }}
</div>
Run Code Online (Sandbox Code Playgroud)

但我想要的是数字数组而不是对象。
我们如何在 Angular 6.* …

angular angular-reactive-forms formarray angular6

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

不存在从 DbType UInt64 到已知 SqlDbType 的映射。精巧的 C#

TotalPrice在我们的 SQL Server 2016 数据库中有一个numeric(20, 3)数据类型的表字段()。

我使用ulongtype 作为我的 C# 属性类型。

public ulong TotalPrice { get; set; }
Run Code Online (Sandbox Code Playgroud)

当我想在我的表中插入一条记录时,发生了以下异常。

不存在从 DbType UInt64 到已知 SqlDbType 的映射

我的 C# 代码插入记录:

const string queryInsertInvoice = @"
INSERT INTO Invoice (CustomerId, Number, TotalPrice, LatestStatusDateTime) 
VALUES (@CustomerId, @Number, @TotalPrice, @LatestStatusDateTime)
SELECT SCOPE_IDENTITY();";

var invoiceId = await dbConnection.QueryFirstOrDefaultAsync<int>(queryInsertInvoice, invoice);
Run Code Online (Sandbox Code Playgroud)

我如何使用 Dapper 2.0.53 处理这种情况?

c# sql-server dapper

3
推荐指数
2
解决办法
877
查看次数