网站服务失败
本文关键字:失败 服务 网站 | 更新日期: 2023-09-27 18:09:48
我在asp.net c# VS2010中完成的网站想要从我这里运行,表明以下例外:
> The type initializer for 'PmServiceLayer.PmService' threw an exception.
View Detail:
> {ExceptionDetail, probablemente creado por IncludeExceptionDetailInFaults=true, cuyo valor es:
System.TypeInitializationException: The type initializer for 'PmServiceLayer.PmService' threw an exception. ----> System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
at PmServiceLayer.PmService..cctor()
--- Fin del seguimiento de la pila ExceptionDetail interna ---
at PmServiceLayer.PmService..ctor()
at CreatePmServiceLayer.PmService()
at System.ServiceModel.InstanceContext.GetServiceInstance(Message message)
at System.ServiceModel.Dispatcher.InstanceBehavior.EnsureServiceInstance(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)}
>
>
Server stack trace:
en System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
en System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
en System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
en System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
en System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
>
> Exception rethrown at [0]: en
> System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
> reqMsg, IMessage retMsg) en
> System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
> msgData, Int32 type) en
> PmPresentationLayer.WcfPmService.IpmContract.VoidInternalBatches()
> en
> PmPresentationLayer.WcfPmService.IpmContractClient.VoidInternalBatches()
> en C:'Users'maquino.CPM'Desktop'Intranet'PmPresentationLayer'Service
> References'WcfPmService'Reference.cs:línea 742 en
> PmPresentationLayer.PmAgent.VoidInternalBatches() en
> C:'Users'maquino.CPM'Desktop'Intranet'PmPresentationLayer'Code'PmAgent.cs:línea
> 284 en PmPresentationLayer.SiteMaster.Page_Load(Object sender,
> EventArgs e) en
> C:'Users'maquino.CPM'Desktop'Intranet'PmPresentationLayer'Site.Master.cs:línea
> 25 en
> System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
> EventArgs e) en System.Web.UI.Control.OnLoad(EventArgs e) en
> System.Web.UI.Control.LoadRecursive() en
> System.Web.UI.Control.LoadRecursive() en
> System.Web.UI.Control.LoadRecursive() en
> System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
我觉得VoidInternalBatches:
public void VoidInternalBatches()
{
_wcfContractClient = WCFServiceClientSingleton.GetInstance();
_wcfContractClient.VoidInternalBatches();
}
从浏览器标记我以下例外:
> Error de servidor en la aplicación '/'.
The type initializer for 'PmServiceLayer.PmService' threw an exception.
Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.
>
> Detalles de la excepción:
> System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail,
> System.ServiceModel, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089]]: The type initializer for
> 'PmServiceLayer.PmService' threw an exception.
>
> Error de código fuente:
>
>
> Línea 740: Línea 741: public void VoidInternalBatches()
> { Línea 742: base.Channel.VoidInternalBatches(); Línea 743:
> } Línea 744:
>
>
> Archivo de origen:
> C:'Users'maquino.CPM'Desktop'Intranet'PmPresentationLayer'Service
> References'WcfPmService'Reference.cs Línea: 742
>
> Seguimiento de la pila:
>
>
> [FaultException`1: The type initializer for 'PmServiceLayer.PmService'
> threw an exception.]
> System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
> reqMsg, IMessage retMsg) +10818447
> System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
> msgData, Int32 type) +336
> PmPresentationLayer.WcfPmService.IpmContract.VoidInternalBatches() +0
> PmPresentationLayer.WcfPmService.IpmContractClient.VoidInternalBatches()
> in C:'Users'maquino.CPM'Desktop'Intranet'PmPresentationLayer'Service
> References'WcfPmService'Reference.cs:742
> PmPresentationLayer.PmAgent.VoidInternalBatches() in
> C:'Users'maquino.CPM'Desktop'Intranet'PmPresentationLayer'Code'PmAgent.cs:284
> PmPresentationLayer.SiteMaster.Page_Load(Object sender, EventArgs e)
> in
> C:'Users'maquino.CPM'Desktop'Intranet'PmPresentationLayer'Site.Master.cs:25
> System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
> EventArgs e) +51 System.Web.UI.Control.OnLoad(EventArgs e) +92
> System.Web.UI.Control.LoadRecursive() +54
> System.Web.UI.Control.LoadRecursive() +145
> System.Web.UI.Control.LoadRecursive() +145
> System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> +772
>
>
> Información de versión: Versión de Microsoft .NET Framework:4.0.30319;
> Versión ASP.NET:4.0.30319.34249
错误检查行:
Site.Master.cs: 25
protected void Page_Load(object sender, EventArgs e)
{
PmAgent _agent = new PmAgent();
_agent.VoidInternalBatches();
}
PmAgent.cs: 284
public void VoidInternalBatches()
{
_wcfContractClient = WCFServiceClientSingleton.GetInstance();
_wcfContractClient.VoidInternalBatches();
}
Reference.cs: 742
public void VoidInternalBatches() {
base.Channel.VoidInternalBatches();
}
我得到以下代码到服务
虽然webservice:代码
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<appSettings>
<add key="appName" value="cpmapp" />
<add key="appPassword" value="appuser.123" />
</appSettings>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="c:'log'Log.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] ID=%property{EventID} - %message%newline" />
</layout>
</appender>
<!-- Define some output appenders -->
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] ID=%property{EventID} - %message%newline" />
</layout>
</appender>
<!-- Setup the root category, add the appenders and set the default level -->
<root>
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service behaviorConfiguration="basicBh" name="PmServiceLayer.PmService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="usernameHttp" contract="PmContractLayer.IpmContract" />
</service>
<service name="PmServiceLayer.WebService" behaviorConfiguration="WebBh">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="AjaxBehavior" bindingConfiguration="webBinding" contract="PmContractLayer.IwebContract" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="AjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="basicBh">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Windows" />
</serviceCredentials>
</behavior>
<behavior name="WebBh">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Windows" />
</serviceCredentials>
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webBinding" maxBufferSize="520000" maxReceivedMessageSize="520000">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="usernameHttp" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="520000" maxReceivedMessageSize="520000">
<readerQuotas maxDepth="520000" maxStringContentLength="520000" maxArrayLength="520000" maxBytesPerRead="520000" maxNameTableCharCount="520000" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
我为我的语言道歉,我来自阿根廷,甚至我对语言也有困难。
我非常感谢你能给我的帮助,当然也感谢你花时间阅读我的查询。
大家好,早上好!您的项目没有找到log4net的1.2.10版本。有几个选项可以解决这个问题:
- 将正确的版本程序集(log4net 1.2.10)放在它引用的地方。
- 使用NuGet并在package .config中指定你的程序集。
- 升级到最新版本log4net(1.2.13)。
- 从NuGet控制台强制安装log4net:
update-package -reinstall log4net.
- 如果绝望,编辑项目文件(.csproj)并搜索像这样的行:
Reference Include="log4net", Version=1.2.10.0, Culture=neutral ..."
在那里你可以检查版本和引用程序集的位置。
我做了以下操作:PM> update-package - install log4netUpdate-Package:无法找到'log4net'包。在第1行char:15update-package <<
PM> Install-Package log4net正在安装log4net 2.0.3。已成功安装log4net 2.0.3。添加'log4net 2.0.3'到PmPresentationLayer成功添加'log4net 2.0.3'到PmPresentationLayer。也删除log4net项目,但我提出了同样的错误。