Null buffer error - asp.net

I've just noticed that when running an application I periodically get an error message.
Server Error in '/' Application.
Buffer cannot be null.
Parameter name: buffer
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Buffer cannot be null.
Parameter name: buffer
Stack trace:
[ArgumentNullException: Buffer cannot be null.
Parameter name: buffer]
System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable) +12627669
MemcachedProviders.Session.Common.Deserialize(HttpContext context, Byte[] serializedItems, Int32 timeout) +47
MemcachedProviders.Session.Db.SQLDbOperations.GetItem(String strSessionId, String strApplicationName, Int32 iTime, HttpContext context, Boolean lockRecord, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +1221
MemcachedProviders.Session.SessionStateProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +1069
System.Web.SessionState.SessionStateModule.GetSessionStateItem() +178
System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state) +299
[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
System.Web.SessionState.SessionStateModule.EndAcquireState(IAsyncResult ar) +11513726
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +107
Our application uses Enyim memcached and MemcachedProviders and runs in a load balanced environment.
The application does alot of managing of PDF reports and compiling of responses then generating a final report pdf. So we use streams quite a bit.
This problem only appears to affect our management application as we also expose a webservice and I never get the error when looking at the service definition and WSDL.
From looking at the session table in the DB I can see that they are being created but, many of them have null in the SessionItems field and the locked flag set to 1.
The data time stamps seem to correlate to the null buffer error occurances.
Is this a case of a buffer set incorrectly or maxing out?

Related

Deploying Watson Chat on IIS

So I've created a simple ASP .NET site, where you can send a message to the Watson service and receive the response.
It works locally when I run the application from VS2017, but now I've deployed it to my 2012 R2 Server and it doesn't work.
The application runs, but I'm not able to receive any answer from the Watson service.
What am I missing in the IIS?
This is the SDK, I've been using.
https://github.com/watson-developer-cloud/dotnet-standard-sdk
Here is the only error I can find in the eventvwr.
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 25-04-2019 15:51:35
Event time (UTC): 25-04-2019 13:51:35
Event ID: 8eb66320f2fa412ea0a2cf3f61d5f3b2
Event sequence: 19
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/6/ROOT-6-132006738849963250
Trust level: Full
Application Virtual Path: /
Application Path: xxx
Machine name: OSI4908
Process information:
Process ID: 6844
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: HttpException
Exception message: The remote host closed the connection. The error code is 0x80070057.
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush, Boolean async)
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.AspNet.SignalR.Owin.ServerResponse.Write(ArraySegment`1 data)
at Microsoft.AspNet.SignalR.Hosting.ResponseExtensions.End(IResponse response, String data)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

BizTalk error : Unable to process exec message

I've been getting the following error in a production environment. Please refer the error in the bottom. So far I was able to recreate the problem by letting the orchestration suspend by forcing a db timeout in the application db call, and resuming the instance. After repeating the action for 2 rounds on the same instance, third time the instance will get suspended with the error below.
What could be the reason for this behavior?
BizTalk Error
Uncaught exception (see the 'inner exception' below) has suspended an
instance of service '{ORCHESTRATION
NAME}(57adc083-7423-2bff-bd2d-ca813b8c0f4e)'. The service instance
will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state
and may re-throw the same unexpected exception. InstanceId:
1bca1f03-7780-4f45-af2e-020724c8a92d Shape name: ShapeId: Exception
thrown from: segment -1, progress -1 Inner exception: Unable to
process exec message.
Exception type: Exception Source: Microsoft.XLANGs.BizTalk.Engine Target Site: System.Object[]
get_Args() The following is a stack trace that identifies the location
where the exception occured
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXService.get_Args() at
{ORCHESTRATION NAME}.segment1(StopConditions stopOn) at
Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp)
Stack trace
xlang/s engine event log entry: Failed while delivering a message to a
service instance. Message details follow. Message ID:
61eaa7fc-ac85-42d9-bf3e-1bed258b82be Service Instance ID:
1bca1f03-7780-4f45-af2e-020724c8a92d Service Type ID:
57adc083-7423-2bff-bd2d-ca813b8c0f4e Subscription ID:
00000000-0000-0000-0000-000000000000 Body part name: Service type:
{ORCHESTRATION NAME}, {Assembly Details}
Exception type: BTXMessageDeliveryException The following is a stack
trace that identifies the location where the exception occured
at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._receiveOneMessage(Guid&
instanceId, Guid& serviceId, IBTMessage currentMsg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession.ReceiveMessages(IBTMessage[]
messages, Int32 firstIdx, Int32 count) at
Microsoft.BizTalk.XLANGs.BTXEngine.AppDomains.AppDomainRoot.Microsoft.XLANGs.BizTalk.ProcessInterface.IAppDomainStub.ReceiveMessages(Object
objMsg)
Additional error information:
Failed while delivering a message to a service instance. Message details follow. Message ID:
61eaa7fc-ac85-42d9-bf3e-1bed258b82be Service Instance ID:
1bca1f03-7780-4f45-af2e-020724c8a92d Service Type ID:
57adc083-7423-2bff-bd2d-ca813b8c0f4e Subscription ID:
00000000-0000-0000-0000-000000000000 Body part name: Service type:
{ORCHESTRATION NAME}, {Assembly Details}
Exception type: BTXMessageDeliveryException Source:
Microsoft.XLANGs.BizTalk.Engine Target Site: Void
DeliverMessage(System.Guid,
Microsoft.BizTalk.Agent.Interop.IBTMessage, Boolean ByRef) The
following is a stack trace that identifies the location where the
exception occured
at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._tryReceiveOneMessage(Boolean&
loggedError, Guid& instanceId, IBTMessage currMsg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._receiveOneMessage(Guid&
instanceId, Guid& serviceId, IBTMessage currentMsg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession.ReceiveMessages(IBTMessage[]
messages, Int32 firstIdx, Int32 count) at
Microsoft.BizTalk.XLANGs.BTXEngine.AppDomains.AppDomainRoot.Microsoft.XLANGs.BizTalk.ProcessInterface.IAppDomainStub.ReceiveMessages(Object
objMsg)
Additional error information:
The XLANG/s message has no part at index '0'. The total number of parts found in the message is '0'. If you expect a multipart
message, check that the pipeline supports multipart messages such as
MIME.
Exception type: MissingPartException Source:
Microsoft.XLANGs.BizTalk.Engine Target Site: Void
ReadMessageState(Microsoft.XLANGs.Core.Envelope,
Microsoft.XLANGs.BaseTypes.XLANGMessage) The following is a stack
trace that identifies the location where the exception occured
at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXXlangStore.ReadMessageState(Envelope
env, XLANGMessage msg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXService.ArgsFromExecEnvelope(IBTMessage
msg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXService.DeliverMessageImpl2(Guid
subscriptionId, IBTMessage msg, Boolean& receiveCompleted) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXService.DeliverMessage(Guid
subscriptionId, IBTMessage msg, Boolean& receiveCompleted)
Received this myself. Not sure what you were doing when you started receiving it. For me, I had a working orchestration and then added a correlation set. I use BTDF so simply updated the GAC only with new orchestration when I really should've done a full re-deploy (I know, lazy.).
Anyway, once I did redeploy fully, cycle hosts, and retest it worked fine.
Probably not answer you are looking for but it helped me. Here was my stack trace:
Exception type: BTXMessageDeliveryException
Source: Microsoft.XLANGs.BizTalk.Engine
Target Site: Void DeliverMessage(System.Guid, Microsoft.BizTalk.Agent.Interop.IBTMessage, Boolean ByRef)
The following is a stack trace that identifies the location where the exception occured
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._tryReceiveOneMessage(Boolean& loggedError, Guid& instanceId, IBTMessage currMsg)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._receiveOneMessage(Guid& instanceId, Guid& serviceId, IBTMessage currentMsg)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession.ReceiveMessages(IBTMessage[] messages, Int32 firstIdx, Int32 count)
at Microsoft.BizTalk.XLANGs.BTXEngine.AppDomains.AppDomainRoot.Microsoft.XLANGs.BizTalk.ProcessInterface.IAppDomainStub.ReceiveMessages(Object objMsg)
at Microsoft.XLANGs.BizTalk.CrossProcess.AppDomainStubProxy.Microsoft.XLANGs.BizTalk.ProcessInterface.IAppDomainStub.ReceiveMessages(Object msgs)
Additional error information:
Index was outside the bounds of the array.

The Security Support Provider Interface (SSPI) negotiation failed

I have error for my custom asp.net
my code asp code:
IServiceConfiguration<IOrganizationService> orgConfigInfo =
ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(new Uri("http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc"));
var creds = new ClientCredentials();
creds.UserName.UserName = "user";
creds.UserName.Password = "pass";
using (_serviceProxy = new OrganizationServiceProxy(orgConfigInfo, creds))
{
// This statement is required to enable early-bound type support.
_serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
_service = (IOrganizationService)_serviceProxy;
using (context srv = new context(_service))
{
Account acc = new Account();
acc.thr_FirstName = firstname.Text;
acc.thr_LastName = lastname.Text;
acc.thr_NationalCode = nationalcode.Text;
acc.EMailAddress1 = email.Text;
acc.thr_Mobile = cellphone.Text;
acc.Telephone1 = tel.Text;
srv.AddObject(acc);
srv.SaveChanges();
alert.ForeColor = System.Drawing.Color.Green;
alert.Text = "با موفقیت ثبت شد";
}
}
and then when i run this code in my visual studio work correctly but when i run in iis i get this error
The Security Support Provider Interface (SSPI) negotiation failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The Security Support Provider Interface (SSPI) negotiation failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The Security Support Provider Interface (SSPI) negotiation failed.]
System.ServiceModel.Security.WindowsSspiNegotiation.GetOutgoingBlob(Byte[] incomingBlob, ChannelBinding channelbinding, ExtendedProtectionPolicy protectionPolicy) +6115112
System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState) +1325
System.ServiceModel.Security.IssuanceTokenProviderBase1.GetNextOutgoingMessage(Message incomingMessage, T negotiationState) +91
System.ServiceModel.Security.IssuanceTokenProviderBase1.DoNegotiation(TimeSpan timeout) +586
[SecurityNegotiationException: SOAP security negotiation with 'http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc' for target 'http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc' failed. See inner exception for more details.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +14489026
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +622
Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request) +0
Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request) +892
Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request) +254
Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChange(OrganizationRequest request, IList`1 results) +43
[SaveChangesException: An error occured while processing this request.]
Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChanges(SaveChangesOptions options) +1791
crm.Reg.submit_Click(Object sender, EventArgs e) +790
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
this error occurs due to the time zone as the server is hosted on some other region which has a different time zone then the local timezone where the web application is running.
to solve this problem server have to manage the offset of every timezone and the simplest way to do it tom manage the time in UTC format. to learn more about UTC click here

Delete the object through tridion core service

I am not able to delete the object through core service.
I am getting object reference not found error. I am able to create and get the object but delete functionality fails.
I am using this code:
var client = new CoreService2010Client();
client.ClientCredentials.Windows.ClientCredential.UserName = Settings.UserID;
client.ClientCredentials.Windows.ClientCredential.Password = Settings.Password;
client.Open();
client.Delete(TCMURI);
here's the error:
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 Tridion.ContentManager.CoreService.Client.ICoreService.Delete(String id)
at Tridion.ContentManager.CoreService.Client.CoreServiceClient.Delete(String id)
at TridionCoreService.Program.testing() in C:\WORK\My Work\TridionCoreService\TridionCoreService\Program.cs:line 125
at TridionCoreService.Program.Main(String[] args) in C:\WORK\My Work\TridionCoreService\TridionCoreService\Program.cs:line 25
I am using above code only and pass the tcm URI
Error Code : {System.ServiceModel.FaultCode}
I had the same error and it was related to UGC.
I disabled UGC (commented out the model and editor in the config and the eventsystem.dll from ugc), restarted the server and everything worked.
Check the 'Tridion' Windows Event Log on the Content Manager Server. There is probably an error related to UGC. I think you need to contact CS to fix this, since the error is in the Eventsystem dll from UGC

Invalid length for a Base-64 char array

I use asp.net + MVC1.0 and in a web-page I have several forms, within each forms I have called the following function AntiForgeryToken() to generate a hidden value, and in Controller function I have a validate attribute.
When I use JMeter and capture the token using regular expression then post the token with my form to server, I found it throw such a exception:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Invalid length for a Base-64 char array.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
[FormatException]: Invalid length for a Base-64 char array.
at System.Convert.FromBase64String(String s)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)
at System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String serializedToken)
[HttpAntiForgeryException]: A required anti-forgery token was not supplied or was invalid.
at System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String serializedToken)
at System.Web.Mvc.ValidateAntiForgeryTokenAttribute.OnAuthorization(AuthorizationContext filterContext)
at System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)
at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.
And I am sure the the captured token is exactly same as what we generated, why this exception happened?
Just solved, because I didn't encode the token before post to server .

Resources