Iis 7 Orchard 324仅在web服务器上使用自定义模块时未发送数据错误
我刚开始有一个非常奇怪的问题,我的自定义模块,直到昨晚才开始发生。基本上,当我尝试请求为模块创建的自定义视图时,前两个页面显示良好,然后这些内容项页面的其余部分突然超时,直到我回收应用程序池。(在浏览器中,我得到一个324无数据发送错误)。在App_数据文件夹下的错误日志中,我也没有收到与此事件相关的错误 以下是我在事件查看器中收到的错误:Iis 7 Orchard 324仅在web服务器上使用自定义模块时未发送数据错误,iis-7,module,orchardcms,application-pool,timeoutexception,Iis 7,Module,Orchardcms,Application Pool,Timeoutexception,我刚开始有一个非常奇怪的问题,我的自定义模块,直到昨晚才开始发生。基本上,当我尝试请求为模块创建的自定义视图时,前两个页面显示良好,然后这些内容项页面的其余部分突然超时,直到我回收应用程序池。(在浏览器中,我得到一个324无数据发送错误)。在App_数据文件夹下的错误日志中,我也没有收到与此事件相关的错误 以下是我在事件查看器中收到的错误: 3005 An unhandled exception has occurred. 12/31/2012 12:03:17 PM 1
3005
An unhandled exception has occurred.
12/31/2012 12:03:17 PM
12/31/2012 5:03:17 PM
59d62d1f2da347caafd2dee71266126f
43
1
0
/LM/W3SVC/10/ROOT-2-130014459492939950
Full
/
E:\Inetpub\Test-Website\
SERVERNAME
24756
w3wp.exe
NT AUTHORITY\NETWORK SERVICE
TimeoutException
Transaction Timeout
(the url was displayed here)
admin
True
Forms
NT AUTHORITY\NETWORK SERVICE
39
NT AUTHORITY\NETWORK SERVICE
False
我的开发人员计算机上没有此问题(在iis或visual studio上运行网站不会重现此问题)
我几乎可以肯定的是,模块的设置是为了有效地处理每个连接。另外,考虑到自从网站上线以来(大约一个月了),这种情况就没有发生过,我猜这与代码无关
下面是我如何设置服务类的示例:
namespace Example.Services
{
public interface IDocumentNoteService : ITransientDependency
{
List<DocumentNoteRecord> GetNotes(int? packageId, int noteTypeId);
}
public class DocumentNoteService : IDocumentNoteService
{
private readonly IRepository<DocumentNoteRecord> _docNoteRepo;
public DocumentNoteService(IRepository<DocumentNoteRecord> docNoteRepo)
{
_docNoteRepo = docNoteRepo;
Logger = NullLogger.Instance;
T = NullLocalizer.Instance;
}
public ILogger Logger { get; set; }
public Localizer T { get; set; }
public List<DocumentNoteRecord> GetNotes(int? packageId, int noteTypeId)
{
try {
var Notes = _docNoteRepo.Table.Where(x => x.Package_Id == packageId).Where(x => x.Note_Type_Id == noteTypeId).ToList();
_docNoteRepo.Flush();
return Notes;
}
catch (Exception ex) {
Logger.Error(ex, "There was a problem getting the document notes for this tour.");
}
return Enumerable.Empty<DocumentNoteRecord>().ToList<DocumentNoteRecord>();
}
}
}
名称空间示例.Services
{
公共接口IDocumentNoteService:ITransientDependency
{
列表GetNotes(int?packageId,int noteTypeId);
}
公共类DocumentNoteService:IDocumentNoteService
{
私人只读电子储蓄_docNoteRepo;
公共文档记录服务(IRepository docNoteRepo)
{
_docNoteRepo=docNoteRepo;
Logger=NullLogger.Instance;
T=NullLocalizer.Instance;
}
公共ILogger记录器{get;set;}
公共定位器T{get;set;}
公共列表GetNotes(int?packageId,int noteTypeId)
{
试一试{
var Notes=\u docNoteRepo.Table.Where(x=>x.Package\u Id==packageId).Where(x=>x.Note\u Type\u Id==noteTypeId).ToList();
_docNoteRepo.Flush();
回条;
}
捕获(例外情况除外){
Logger.Error(例如,“获取此教程的文档注释时出现问题”);
}
返回可枚举的.Empty().ToList();
}
}
}
以下是零件驱动程序的代码:
namespace ExampleCode.Drivers
{
public class TourPartDriver : ContentPartDriver<TourPart> {
private readonly ITourPartService _tourPartService;
private readonly ITourDateService _tourDateService;
private readonly IItinDetailService _tourItinDetailsService;
private readonly IExperiencesService _tourExpService;
private readonly ITourOptionService _tourOptionService;
private readonly IDestinationFactService _destinationFactService;
private readonly IDestinationFactManager _destinationFactManager;
private readonly IDocumentNoteService _documentNoteService;
private readonly IPackageUpgradesService _packageUpgradesService;
public TourPartDriver(
ITourPartService tourService,
ITourDateService tourDateService,
IItinDetailService tourItinDetailsService,
IExperiencesService tourExpService,
ITourOptionService tourOptionService,
IDestinationFactService destinationFactService,
IDestinationFactManager destinationFactManager,
IDocumentNoteService documentNoteService,
IPackageUpgradesService packageUpgradesService
) {
_tourPartService = tourService;
_tourDateService = tourDateService;
_tourItinDetailsService = tourItinDetailsService;
_tourExpService = tourExpService;
_tourOptionService = tourOptionService;
_destinationFactService = destinationFactService;
_destinationFactManager = destinationFactManager;
_documentNoteService = documentNoteService;
_packageUpgradesService = packageUpgradesService;
Logger = NullLogger.Instance;
T = NullLocalizer.Instance;
}
public ILogger Logger { get; set; }
public Localizer T { get; set; }
protected override DriverResult Display(
TourPart part, string displayType, dynamic shapeHelper) {
return ContentShape("Parts_Tour", () => shapeHelper.Parts_Tour(
TourID: part.tour_id,
TourName: part.tour_name,
PackageID: part.package_id,
Highlights: _tourExpService.GetTourExperiences(part.tour_id, part.package_id),
Description: part.description,
TourDates: _tourDateService.GetTourDatesDD(part.tour_id),
TourItinDetails: _tourItinDetailsService.GetItinDetails(part.package_id),
InitialTourOffsetDate: _tourDateService.GetInitialTourDateOffset(part.package_id),
TourOptions: _tourOptionService.GetInitialTourOptions(part.package_id),
TourPrice: _tourDateService.GetTourPrice(part.package_id),
TourNumDays: _tourItinDetailsService.GetTourNumDays(part.package_id),
TourNumMeals: _tourDateService.GetTourNumMeals(part.package_id),
DestinationFacts:_destinationFactManager.GetCategoryFacts(part.package_id),
PleaseNote: _documentNoteService.GetNotes(part.package_id, (int)NoteTypes.DocNoteType.PleaseNote),
WebRemarks: _documentNoteService.GetNotes(part.package_id, (int)NoteTypes.DocNoteType.WebRemarks),
Pace: _documentNoteService.GetNotes(part.package_id, (int)NoteTypes.DocNoteType.Pace),
PackageUpgrades: _packageUpgradesService.GetInitialPackageUpgrades(part.package_id)
));
}
}
}
namespace ExampleCode.Drivers
{
公共类TourPartDriver:ContentPartDriver{
私人只读ITourPartService\u tourPartService;
私人只读ITourDateService(u tourDateService);
私人只读IItinDetailService(旅游详情服务);
私人只读IEExperienceService\u tourExpService;
私人只读ITourOptionService\u tourOptionService;
专用只读IDestinationFactService _destinationFactService;
私有只读IDestinationFactManager\u destinationFactManager;
私有只读IDocumentNoteService\u documentNoteService;
专用只读IPackageUpgradesService _packageUpgradesService;
公共旅行车司机(
ITourPartService tourService,
ITourDateService tourDateService,
IItinDetailService旅游详情服务,
IEExperienceService tourExpService,
iTourOption服务TourOption服务,
IDestinationFactService目的地FactService,
IDestinationFactManager目的地FactManager,
IDocumentNoteService文档NoteService,
iPackage升级服务包升级服务
) {
_tourPartService=tourService;
_tourDateService=tourDateService;
_TouritinDetails服务=TouritinDetails服务;
_tourExpService=tourExpService;
_TourOptions服务=TourOptions服务;
_destinationFactService=destinationFactService;
_destinationFactManager=destinationFactManager;
_documentNoteService=documentNoteService;
_packageUpgradesService=packageUpgradesService;
Logger=NullLogger.Instance;
T=NullLocalizer.Instance;
}
公共ILogger记录器{get;set;}
公共定位器T{get;set;}
受保护的超越驱动器结果显示(
TourPart部件、字符串显示类型、动态形状帮助){
返回ContentShape(“Parts\u-Tour”,()=>shapehelp.Parts\u-Tour(
TourID:part.TourID\u id,
TourName:part.tour\u name,
PackageID:part.package_id,
亮点:_tourExpService.getTourExperience(part.tour\u id,part.package\u id),
说明:零件说明,
TourDates:_tourDateService.GetTourDatesDD(部分TourDateID),
TourItinDetails:\u TourItinDetails服务.获取详细信息(部件.包\u id),
InitialTourOffsetDate:\u tourDateService.GetInitialTourDateOffset(部件包\u id),
TourOptions:_TourOptionsService.GetInitialTourOptions(部件包\u id),
TourPrice:\u tourDateService.GetTourPrice(部件包\u id),
TourNumDays:_tourItinDetailsService.GetTourNumDays(part.package_id),
Tourummeals:_tourDateService.GetTourummeals(part.package_id),
DestinationFacts:_destinationFactManager.GetCategoryFacts(part.package_id),
PleaseNote:_documentNoteService.GetNotes(part.package_id,(int)NoteTypes.DocNoteType.PleaseNote),
Web备注:_documentNoteService.GetNotes(part.package_id,(int)NoteTypes.DocNoteType.web备注),
Pace:_documentNoteService.GetNotes(part.package_id,(int)NoteTypes.DocNoteType.Pace),
PackageUpgrades:_packageUpgradesService.GetInitialPackageUpgrades(part.package_id)
));
}
}
}
以下是视图的代码:
@{
List<DocumentNoteRecord> pleaseNote = Model.PleaseNote;
List<DocumentNoteRecord> webRemarks = Model.WebRemarks;
List<DocumentNoteRecord> pace = Model.Pace;
if (pleaseNote.Count > 0)
{
<h4 class="tourSubTitle1">Please Note</h4>
foreach (var note in pleaseNote) {
<p>@Html.Raw(note.Note)</p>
}
}
if (webRemarks.Count > 0) {
<h4 class="tourSubTitle1">Web Remarks</h4>
foreach (var noteRemark in webRemarks) {
<p>@Html.Raw(noteRemark.Note)</p>
}
}
if (pace.Count > 0)
{
<h4 class="tourSubTitle1">Pace</h4>
foreach (var notePace in pace)
{
<p>@Html.Raw(notePace.Note)</p>
}
}
@{
List pleaseNote=Model.pleaseNote;
List WebComments=Model.webComments;
List-pace=Model.pace;
如果(请注意计数>0)
{
请注意
foreach(var注一)