您现在的位置是:首页 > 编程 > 

服务器2012系统崩溃,意外的Windows服务器2012 R2上的WCF服务崩溃

2025-07-15 04:12:38
这将是很长的后,因为我想尽可能解释和详细说明我的问题。我是后端开发新手,现在我正在使用WCF,C࿰和.ET Framework 4.5开发安全(https)REST Web服务。对于这种情况,我使用在IIS中配置的自签名证书。 我的问题是,服务主机似乎随机崩溃,没有任何异常或消息在跟踪日志。我在Wi

这将是很长的后,因为我想尽可能解释和详细说明我的问题。我是后端开发新手,现在我正在使用WCF,C࿰和.ET Framework 4.5开发安全(https)REST Web服务。对于这种情况,我使用在IIS中配置的自签名证书。 我的问题是,服务主机似乎随机崩溃,没有任何异常或消息在跟踪日志。我在Windows Server 2012 R2上的VMware中进行了测试。在其他操作系统上(WS 2008,WS 2010)似乎工作正常。 这里是我如何与注册事件处理程序的故障状态启动服务:意外的Windows服务器2012 R2上的WCF服务崩溃

private ServiceHost listener = null;

public void Start(byte[] certData, string certPassword) {

int port = Config.MobileServicePort;

SslCertificate cert = new SslCertificate();

cert.RemoveCertificate(port);

cert.InstallCertificate(port, certData, certPassword);

Uri uri = new Uri(string.Format(https://127.0.0.1:{0}/{1}, port, MobileService));

if (listener != null) {

listener.Close();

listener = null;

}

listener = new ServiceHost(typeof(MobileService), uri);

listener.Faulted = FaultedStateHandling;

try {

listener.Open();

Logger.System().Info(REGISTER service at {0} , uri.ToString());

} catch (TimeoutException timeEx) {

Logger.System().Error(Open timeout exception:   timeEx);

} catch (CommunicationException comEx) {

Logger.System().Error(Open communication exception:   comEx);

} catch (Exception ex) {

Logger.System().Error(ex);

}

}

这里是处理器的故障状态:

private void FaultedStateHandling(object sender, EventArgs e) {

try {

Logger.System().Info();

listener.Abort();

listener.Faulted -= new EventHandler(FaultedStateHandling);

int port = Config.MobileServicePort;

Uri uri = new Uri(string.Format(https://127.0.0.1:{0}/{1}, port, MobileService));

listener = new ServiceHost(typeof(MobileService), uri);

listener.Faulted = new EventHandler(FaultedStateHandling);

listener.Open();

Logger.System().Info();

} catch (Exception ex) {

Logger.System().Error(ex);

}

}

这是我的配置MessageLogging和跟踪:

switchValue=Critical,Information,ActivityTracing

propagateActivity=true>

type=System.Diagnostics.XmlWriterTraceListener

initializeData=c:\log\TraceMessages.svclog />

type=System.Diagnostics.XmlWriterTraceListener

initializeData=c:\log\MessageLogging.svclog />

logEntireMessage=false

logMalformedMessages=true

logMessagesAtServiceLevel=true

logMessagesAtTransportLevel=false

maxMessagesToLog=500

maxSizeOfMessageToLog=5000/>

bindingConfiguration=webHttpTransportSecurity

behaviorConfiguration=REST

contract=noq.Mobile.Service.IMobileService>

binding=mexHttpsBinding

contract=IMetadataExchange />

maxReceivedMessageSize=1000000000>

我用这个问题存货了大约1个月,并且不到解决方案。我尝试了很多配置,看起来问题更深入。我检查了MSD论坛和。在那里我发现了类似的问题,但不一样,他们提供了一些热修复,如that。 这个问题可能与虚拟机配置有关吗? 在此先感谢您并提供任何建议。

2016-06-08

Artiom

0

事件日志(应用程序日志或系统日志)告诉你什么? –

0

嗨,@rene,所以在WCF跟踪中,我发现了一条错误消息:无法到与绑定BasicHttpBinding的端点匹配方案http的基地址。注册的基地址方案是[]。 –

0

@rene [微软提供的修补程序](https:///en-us/kb/257715),但仅适用于WS2008R2。我试图通过在文件中设置BaseAddress来解决此问题,使得此错误不再出现,但它不能解决问题服务仍然崩溃的问题。我尝试了几乎所有类型的服务配置,但仍然没有结果。在系统日志和应用程序日志中 - 什么也没有,服务只是停止响应从客户端(Android),当服务关闭时,在日志中看到消息:握手期间发生未知错误。 –

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/biancheng/1089851.html

相关标签:无
上传时间: 2025-07-14 20:19:41
留言与评论(共有 5 条评论)
本站网友 双井ume
12分钟前 发表
  timeEx);} catch (CommunicationException comEx) {Logger.System().Error(Open communication exception
本站网友 三七的功效和作用
5分钟前 发表
\log\TraceMessages.svclog />type=System.Diagnostics.XmlWriterTraceListenerinitializeData=c
本站网友 青岛房屋维修基金
17分钟前 发表
MobileService));if (listener != null) {listener.Close();listener = null;}listener = new ServiceHost(typeof(MobileService)
本站网友 旅游百事通官网
21分钟前 发表
\log\MessageLogging.svclog />logEntireMessage=falselogMalformedMessages=truelogMessagesAtServiceLevel=truelogMessagesAtTransportLevel=falsemaxMessagesToLog=500maxSizeOfMessageToLog=5000/>bindingConfiguration=webHttpTransportSecuritybehaviorConfiguration=RESTcontract=noq.Mobile.Service.IMobileService>binding=mexHttpsBindingcontract=IMetadataExchange />maxReceivedMessageSize=1000000000>我用这个问题存货了大约1个月,并且不到解决方案