When executing Install-SPUserSolution powershell command the following error is shown:
Install-SPUserSolution : Sandboxed code execution request failed.
At line:1 char:23
+ Install-SPUserSolution <<<< -Identity some_package.wsp -Site http://localhost/sites/test
+ CategoryInfo : InvalidData: (Microsoft.Share...allUserSolution:
SPCmdletInstallUserSolution) [Install-SPUserSolution], SPUserCodeExecu...F
ailedException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletInstallU
serSolution
When I try to activate the user solution from the SharePoint interface everything works fine. So this doesn't work only from PowerShell. I tried to run user code service under different account (admin account) but this didn't help. Currently this service is running under Network Service account.
Also when I run Add-SPUserSolution or Uninstall-SPUserSolution they work just fine. I was able to reproduce this issue on at least two servers. Please advice.
[UPD] I'm including full stack trace from SharePoint logs
Sandboxed code execution request failed. - Inner Exception: System.InvalidOperationException Server stack trace: at Microsoft.SharePoint.Utilities.Verify.DoFailTag(UInt32 tag, ULSCat category, Type type, String format, Object[] args) at Microsoft.SharePoint.Utilities.Verify.IsTrueTag(UInt32 tag, ULSCat category, Boolean expression, Type type, String format, Object[] args) at Microsoft.SharePoint.UserCode.SPUserCodeExecutionHost.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinity, SPUserCodeExecutionContext executionContext) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.SharePoint.Administration.ISPUserCodeExecutionHostProxy.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinityBucketName, SPUserCodeExecutionContext executionContext) at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.Execute(Type userCodeWrapperType, SPSite site, SPUserCodeExecutionContext executionContext)
Related
Where can I see the Assembly that Azure functions is trying to load ? (Like fuslogvw on windows)
Update
Update the title as requested to better reflect the accepted answer
Update
Changed my code to 'manually' construct the SOAP request using WebClient and it works ... so me thinks somewhere the WCF service proxy is not playing well within the sandbox that is Azure Functions ... Nevertheless I would still like an answer as to how we can see the Assembly binding log views.
Original Post
I keep getting the same error :
2016-11-17T10:32:44.392 System.IO.FileNotFoundException: The filename,
directory name, or volume label syntax is incorrect. (Exception from
HRESULT: 0x8007007B)
Server stack trace:
at
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo)
at Microsoft.Win32.Fusion.ReadCache(ArrayList alAssems, String
name, UInt32 nFlag)
at System.Reflection.RuntimeAssembly.EnumerateCache(AssemblyName
partialName)
at
System.Reflection.RuntimeAssembly.LoadWithPartialNameInternal(AssemblyName
an, Evidence securityEvidence, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadWithPartialName(String
partialName, Evidence securityEvidence)
at System.Xml.Serialization.TempAssembly.LoadGeneratedAssembly(Type
type, String defaultNamespace, XmlSerializerImplementation& contract)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[]
mappings, Type type)
at
System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GenerateSerializers()
at
System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GetSerializer(Int32
handle)
at
System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.MessageInfo.get_BodySerializer()
at
System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter
writer, MessageVersion version, String action, MessageDescription
messageDescription, Object returnValue, Object[] parameters, Boolean
isRequest)
at
System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter
writer, MessageVersion version, Object[] parameters, Object
returnValue, Boolean isRequest)
at
System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter
writer)
at
System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter
writer)
at
System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter
writer)
at
System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message
message, Stream stream)
at
System.ServiceModel.Channels.HttpOutput.WriteStreamedMessage(TimeSpan
timeout)
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message
message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message
message, TimeSpan timeout)
at
System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message
message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
Object[] outs, TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)
Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
Currently, there is no support to view assembly binding logs. Enabling diagnostic logs will help debug most of the errors. Also take a look at logging tips and tricks.
Here is a sample for connecting to a WCF service hosted in Azure from your function:
Got to Function App Settings --> Go to Kudu --> Go to D:\home\site\wwwroot\YourFunction
Create folder bin
Upload System.ServiceModel.dll
Upload WCF service contract IService1.csx. You can do this from either Kudu or View Files on the portal
#r "System.ServiceModel.dll"
using System.ServiceModel;
[ServiceContract]
public interface IService1
{
[OperationContract]
string GetData(int value);
[OperationContract]
string WelComeMessage(String name);
}
Sample queue trigger that invokes WCF endpoint:
#r "System.ServiceModel.dll"
#load "IService1.csx"
using System;
using System.ServiceModel;
public static void Run(string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
BasicHttpBinding b = new BasicHttpBinding();
EndpointAddress ea = new EndpointAddress("http://YourServiceAddress/service1.svc?wsdl");
var myChannelFactory = new ChannelFactory<IService1>(b, ea);
IService1 client = myChannelFactory.CreateChannel();
var msg= client.WelComeMessage("HelloWorld");
((ICommunicationObject)client).Close();
log.Info($"Hello from WCF: {msg}");
}
Hope this helps!
We have sitecore 8.1 hosted in Azure WEB Apps. The setup is 1xCA and 2xCD and using LUCENE
We noticed a error log below which I googled but could not get solution.
ManagedPoolThread #12 2015:12:28 23:22:33 ERROR Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
at Sitecore.Reflection.MethodInstance.Invoke()
at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.PipelineMethod.Invoke(Object[] parameters)
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Jobs.Job.ThreadEntry(Object state)
Nested Exception
Exception: Lucene.Net.Store.LockObtainFailedException
Message: Lock obtain timed out: NativeFSLock#D:\home\site\wwwroot\App_Data\data\indexes\sitecore_web_index\write.lock: System.IO.IOException: The process cannot access the file 'D:\home\site\wwwroot\App_Data\data\indexes\sitecore_web_index\write.lock' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Lucene.Net.Store.NativeFSLock.Obtain()
Source: Lucene.Net
at Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout)
at Sitecore.ContentSearch.LuceneProvider.DiagnosticLockFactory.DiagnosticLock.Obtain(Int64 lockWaitTimeout)
at Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, IndexDeletionPolicy deletionPolicy, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit)
at Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, Boolean create, MaxFieldLength mfl)
at Sitecore.ContentSearch.LuceneProvider.Sharding.LuceneShard.CreateWriter(Directory directory, LuceneIndexMode mode)
at Sitecore.ContentSearch.LuceneProvider.Sharding.LuceneShard.CreateWriter(IProviderUpdateContext context, LuceneIndexMode mode)
at Sitecore.ContentSearch.LuceneProvider.LuceneIndex.CreateWriter(IProviderUpdateContext context, Shard shard, LuceneIndexMode mode)
at Sitecore.ContentSearch.LuceneProvider.LuceneUpdateContext.InitializeWriter(UpdateContextShardState shardState, LuceneIndexMode mode)
at Sitecore.ContentSearch.LuceneProvider.LuceneUpdateContext.InitializeWriters()
at Sitecore.ContentSearch.LuceneProvider.LuceneUpdateContext.EnsureInitializeWriters()
at Sitecore.ContentSearch.LuceneProvider.LuceneUpdateContext.UpdateDocument(Object itemToUpdate, Object criteriaForUpdate, IExecutionContext[] executionContexts)
at Sitecore.ContentSearch.LuceneProvider.LuceneUpdateContext.UpdateDocument(Object itemToUpdate, Object criteriaForUpdate, IExecutionContext executionContext)
at Sitecore.ContentSearch.LuceneProvider.LuceneIndexOperations.Update(IIndexable indexable, IProviderUpdateContext context, ProviderIndexConfiguration indexConfiguration)
at Sitecore.ContentSearch.SitecoreItemCrawler.UpdateItemVersion(IProviderUpdateContext context, Item version, IndexEntryOperationContext operationContext)
at Sitecore.ContentSearch.SitecoreItemCrawler.DoUpdate(IProviderUpdateContext context, SitecoreIndexableItem indexable, IndexEntryOperationContext operationContext)
at Sitecore.ContentSearch.SitecoreItemCrawler.Update(IProviderUpdateContext context, IIndexableUniqueId indexableUniqueId, IndexEntryOperationContext operationContext, IndexingOptions indexingOptions)
at Sitecore.ContentSearch.AbstractSearchIndex.PerformUpdate(IEnumerable`1 indexableInfo, IndexingOptions indexingOptions)
at Sitecore.ContentSearch.AbstractSearchIndex.Update(IEnumerable`1 indexableInfo)
Nested Exception
Exception: System.IO.IOException
Message: The process cannot access the file 'D:\home\site\wwwroot\App_Data\data\indexes\sitecore_web_index\write.lock' because it is being used by another process.
Source: mscorlib
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Lucene.Net.Store.NativeFSLock.Obtain()
Web Apps makes a bit tricky to debug as we don't have access to IIS or event logs etc. Any suggestion would be appreciated.
What you should do is go to that location and just remove the write.lock file. If its being used by another process then use something like fileunlocker, unlock the file and then delete. It does this quite a lot with git and lucene.
In Azure Web Apps, you do have access to those logs and many other troubleshooting tools. Navigate to //<yourwebsitename>.scm.azurewebsites.net and explore your options in the Kudu tool. Especially check the Tools | Support menu option. You'll need to enable logging in your web app first.
Getting error when access an application hosted in IIS7 in Windows server 2008 R2.
Error:
Exception Source: mscorlib:ListFunctions_LoadNamePrefixes()
Stack Trace:
Server stack trace:
at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()
at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.get_PrivateKey()
at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.GetSignatureFormatter(String algorithm)
at System.IdentityModel.SignedXml.ComputeSignature(SecurityKey signingKey)
at System.ServiceModel.Security.WSSecurityOneDotZeroSendSecurityHeader.CompletePrimarySignatureCore(SendSecurityHeaderElement[] signatureConfirmations, SecurityToken[] signedEndorsingTokens, SecurityToken[] signedTokens, SendSecurityHeaderElement[] basicTokens)
at System.ServiceModel.Security.WSSecurityOneDotZeroSendSecurityHeader.CreateSupportingSignature(SecurityToken token, SecurityKeyIdentifier identifier)
at System.ServiceModel.Security.SendSecurityHeader.SignWithSupportingToken(SecurityToken token, SecurityKeyIdentifierClause identifierClause)
at System.ServiceModel.Security.SendSecurityHeader.SignWithSupportingTokens()
at System.ServiceModel.Security.SendSecurityHeader.CompleteSecurityApplication()
at System.ServiceModel.Security.SecurityAppliedMessage.OnWriteMessage(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota)
at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)
at System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message message)
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
The certificate is stored in Trusted root.
The certificate is accessed by X509Store in the code.
The application is asp.net application.
Certificate should be placed in LocalMachine\My store (Personal store in Local computer when viewed in mmc). Certificate chain should be able to build and should be valid.
Set rights on private key corresponding to the certificate.
The name of the account that you need to add permission for is IIS APPPOOL\name_of_the_apppool_your_app_runs_under
I'm getting a "Specified cast is not valid." Exception when trying to update an OptionSetValue attribute of a custom field on a custom entity.
This works:
data = new Xrm.Xyz_data()
{
Xyz_dataId = (Guid)entity["xyz_dataId"],
// Xyz_dataStatus = new OptionSetValue(5),
Xyz_IsSyncReqd = true
};
service.Update(data);
But uncomment the OptionSetValue line and it throws this exception:
System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: Specified cast is not valid. (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
With this stack trace:
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.IOrganizationService.Update(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Update(Entity entity)
That looks right to me - I don't use early bound which it looks like you are doing but can you verify that the data context has been refreshed since the picklist attribute was created and published?
If this is a built in state field you will probably need to first do the update and then perform a UpdateStateValueRequest. Excerpt from CRM 2011 SDK -
#region How to update state value
// Modify the state value label from Active to Open.
// Create the request.
UpdateStateValueRequest updateStateValue = new UpdateStateValueRequest
{
AttributeLogicalName = "statecode",
EntityLogicalName = Contact.EntityLogicalName,
Value = 1,
Label = new Label("Open", _languageCode)
};
// Execute the request.
_serviceProxy.Execute(updateStateValue);
#endregion How to update state value
So I finally figured out what was happening. I turned on server side debugging using the same registry settings as CRM 4.0:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM]
"TraceEnabled"=dword:00000001
"TraceCategories"="*:Error"
"TraceCallStack"=dword:00000001
"TraceRefresh"=dword:00000001
I reran my test that was failing, and found this error:
[2011-10-24 18:19:37.990] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread: 14 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ExceptionConverter.ConvertMessageAndErrorCode
at ExceptionConverter.ConvertMessageAndErrorCode(Exception exception, Int32& errorCode)
at ExceptionConverter.ToSingleFaultOther(Exception exception)
at ExceptionConverter.ToSingleFaultUntyped(Exception exception)
at ExceptionConverter.ConvertToFault(Exception exception)
at ExceptionConverter.TryConvertToFaultExceptionInternal(Exception exception, Boolean createNewFaultException, FaultException`1& faultException)
at FaultHelper.ConvertToFault(Exception exception)
at OrganizationSdkServiceInternal.Update(Entity entity, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
at
at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at MessageRpc.Process(Boolean isOperationContextSet)
at ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)
at ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
at ChannelHandler.AsyncMessagePump(IAsyncResult result)
at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at AsyncResult.Complete(Boolean completedSynchronously)
at ReceiveItemAndVerifySecurityAsyncResult`2.InnerTryReceiveCompletedCallback(IAsyncResult result)
at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at AsyncResult.Complete(Boolean completedSynchronously)
at AsyncQueueReader.Set(Item item)
at InputQueue`1.Dispatch()
at ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at _IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
>System.InvalidCastException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #9F125FAE: System.InvalidCastException: Specified cast is not valid.
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry.IntentionalRethrow(Exception chainException, Exception originalException)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry.RethrowRecommended(Exception chainException, Exception originalException)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry.Handle(Exception exceptionToHandle)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl.HandleException(Exception exceptionToHandle)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName, ExceptionPolicyFactory policyFactory)
> at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
> at Common.Services.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
> at XYZ.CRM.Common.Services.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
> at XYZ.CRM.Plugin.Common.PluginBase.OnError(Exception ex)
> at XYZ.CRM.Plugin.Common.PluginBase.Execute(IServiceProvider serviceProvider)
> at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
> at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
And since I was debugging my plugin via a unit test, I realized that another plugin was getting fired when those fields were updated by my plugin, and that plugin was apparently causing an exception. But even worse was that the exception handler was causing another exception, that was getting returned, masking the true exception. I tested a really simple fix by eating any exceptions that the exception handler might throw, and it is working great now! Now to discover why my other plugin is failing...
I have web application that I want to publish and upload to windows azure.
I use Visual Studio 2008.
I click on "publish", chose "Create Service Package Only" in "Publish Cloud Service" window, andclick on "OK".
The publish failed tnd the exception is:
Error 26 The "IsolatedCSPack" task failed unexpectedly.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
Server stack trace:
at System.IO.MemoryStream.set_Capacity(Int32 value)
at System.IO.MemoryStream.EnsureCapacity(Int32 value)
at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Packaging.SparseMemoryStream.CopyMemoryBlocksToStream(Stream targetStream)
at MS.Internal.IO.Packaging.SparseMemoryStream.WriteToStream(Stream stream)
at MS.Internal.IO.Zip.ZipIOFileItemStream.Save()
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.Save()
at MS.Internal.IO.Zip.ZipIOBlockManager.SaveContainer(Boolean closingFlag)
at MS.Internal.IO.Zip.ZipIOBlockManager.SaveStream(ZipIOLocalFileBlock blockRequestingFlush, Boolean closingFlag)
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Packaging.PackagePart.Close()
at System.IO.Packaging.Package.DoClose(PackagePart p)
at System.IO.Packaging.Package.DoOperationOnEachPart(PartOperation operation)
at System.IO.Packaging.Package.System.IDisposable.Dispose()
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreateRolePackages(ModelProcessor modelProcessor, PackageManifest applicationManifest, Package applicationPackage)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreatePackage(Stream outputStream)
at Microsoft.ServiceHosting.Tools.Packaging.ServiceApplicationPackage.CreateServiceApplicationPackage(String serviceModelFileName, String serviceDescriptionFile, Stream output, IPackageSecurity encrypt, Dictionary`2 namedStreamCollection, String userInfo, EventHandler`1 rolePackagePartAddedHandler)
at Microsoft.ServiceHosting.Tools.Packaging.ServiceApplicationPackage.CreateServiceApplicationPackage(String serviceModelFileName, String serviceDescriptionFile, Stream output, RSACryptoServiceProvider encrypt, Dictionary`2 namedStreamCollection, String userInfo, EventHandler`1 rolePackagePartAddedHandler)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.TryCreatePackage(ServiceDefinitionModel sm)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.Execute()
at Microsoft.CloudExtensions.MSBuildTasks.IsolatedCSPack.RemoteCSPackBridge.Execute(TaskLoggingHelper log, IBuildEngine buildEngine, ITaskHost hostObject, String serviceHostingTasksPath, String output, String serviceDefinitionFile, ITaskItem[] packRoles, Boolean copyOnly, String generateConfigurationFile, Boolean noEncryptPackage, ITaskItem[]& copiedFiles, ITaskItem[]& outputFiles)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.CloudExtensions.MSBuildTasks.IsolatedCSPack.RemoteCSPackBridge.Execute(TaskLoggingHelper log, IBuildEngine buildEngine, ITaskHost hostObject, String serviceHostingTasksPath, String output, String serviceDefinitionFile, ITaskItem[] packRoles, Boolean copyOnly, String generateConfigurationFile, Boolean noEncryptPackage, ITaskItem[]& copiedFiles, ITaskItem[]& outputFiles)
at Microsoft.CloudExtensions.MSBuildTasks.IsolatedCSPack.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) C:\Program Files\MSBuild\Microsoft\Cloud Service\v1.0\Microsoft.CloudService.targets 865 5 Starlims.SDMS.Azure
How can i resolve this?
Happened to me before... try restarting the computer (I know... it's a bit "Technical Support" advice - but it worked for me!
This looks like the same problem someone else posted about on the MSDN Azure forum. Their problem was that a resource was being copied into the project with:
build action = Content
Copy to Output Directory = Copy if Newer.
They changed the latter to Never and the problem went away.