2

我的应用程序已从 ASP.net 迁移到 Azure。在 Compute Emulator 中运行时,它会给出以下异常:

Server.GetLastError().GetBaseException()
{"Response is not available in this context."}
    [System.Web.HttpException]: {"Response is not available in this context."}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    InnerException: null
    Message: "Response is not available in this context."
    Source: "System.Web"

    StackTrace: "   at System.Web.UI.Page.get_Response()\r\n   at Writehome_aspxToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )\r\n   at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declare
dType)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at WritePlaceHolderToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )\r\n   at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.S
erializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at WriteArrayOfControlToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , Collection
DataContract )\r\n   at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDec
laredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at WriteArrayOfanyTypeToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )\r\n   at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n   a
t System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at WriteSerializableSessionStateStoreDataToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )\r\n   at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n   at System.Runtime.Serialization.NetDataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContract contract, Hashtable surrogateDataContracts)\r\n   at System.Runtime.Serialization.NetDataContractSerializer.InternalWr
iteObject(XmlWriterDelegator writer, Object graph)\r\n   at System.Runtime.Serialization.XmlObjectSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)\r\n   at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)\r\n   at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter writer, Object graph)\r\n   at Microsoft.ApplicationServer.Caching.NetDataContractCacheObjectSerializer.Serialize(Stream stream, Object value)\r\n   at Microsoft.ApplicationServer.Caching.DataCacheObjectSerializationProvider.SerializeUserObject(Object userObject, Boolean isCompressionEnabled, ValueFlagsVersion flagsType)\r\n   at Microsoft.ApplicationServer.Caching.SocketClientProtocol.SerializeValue(Object obj)\r\n   at Microsoft.ApplicationServer.Caching.SocketClientProtocol.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle,
 TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener)\r\n   at Microsoft.ApplicationServer.Caching.DataCache.InternalPutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener)\r\n   at Microsoft.ApplicationServer.Caching.DataCache.<>c__DisplayClass9c.<PutAndUnlock>b__9b()\r\n   at Microsoft.ApplicationServer.Caching.MonitoringListenerFactory.EmptyListener.Microsoft.ApplicationServer.Caching.IMonitoringListener.Listen[TResult](Func`1 innerDelegate)\r\n   at Microsoft.ApplicationServer.Caching.DataCache.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout)\r\n   at Microsoft.Web.DistributedCache.DataCacheWrapper.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout)\r\n   at Microsoft.Web.DistributedCache.DataCacheForwarderBase.<>c__DisplayClass1c.<PutAndUnlock>b__1b()\r\n   at Microsoft.Web.DistributedCache.DataCacheFo
rwarderBase.<>c__DisplayClass31`1.<PerformCacheOperation>b__30()\r\n   at Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action)\r\n   at Microsoft.Web.DistributedCache.DataCacheForwarderBase.PerformCacheOperation[TResult](Func`1 func)\r\n   at Microsoft.Web.DistributedCache.DataCacheForwarderBase.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout)\r\n   at Microsoft.Web.DistributedCache.BlobBasedSessionStoreProvider.SetAndReleaseItemExclusive(HttpContextBase context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)\r\n   at Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)\r\n   at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)\r\n   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Exec
ute()\r\n   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)"
    TargetSite: {System.Web.HttpResponse get_Response()}

所以我尝试将它部署在带有 IntelliTrace 日志的 Azure 订阅中,所以它显示以下异常,

System.Web.HttpException

Invalid file name for file monitoring: 'E:\sitesroot\0\CustomControls'. Common reasons for failure include:
The filename is not a valid Win32 file name.
The filename is not a absolute path.
The filename contains wildcard characters.
The file specified is a directory.
Access denied.

Invalid file name for file monitoring: 'E:\sitesroot\0\MasterPages. Common reasons for failure include:
The filename is not a valid Win32 file name.
The filename is not a absolute path.
The filename contains wildcard characters.
The file specified is a directory.
Access denied.
4

3 回答 3

1

克里斯蒂安在上述评论中的回答对我有用。而且我什至没有使用 Azure,只是想调试一个 asp.net mvc4 项目。

在工具/选项/调试/常规下选中“仅启用我的代码”使其在我的情况下消失。

于 2013-05-23T18:58:32.080 回答
1

按照这个链接

根本不是解决方案,但清除我所有的临时文件 C:\Windows\Microsoft.NET\Framework\v4\Temporary ASP.NET 文件(或足够接近的文件) -可能有效

于 2013-02-08T04:18:35.900 回答
0

清除临时文件对我不起作用,因为该文件夹中没有临时文件……哈哈!让 API 不从 System.Web.HttpException 抛出异常是一种解决方法,但是这些错误仍然存​​在于后台消耗进程。在地毯下扫除错误是非常糟糕的做法。

在stackoverflow上找到了这个相关的帖子,这可能会有所帮助

于 2014-03-06T21:03:55.163 回答