CertificateUnknown error when connecting to Heroku Postgres database - asp.net

So I am in the middle of migrating from SQL Server to PostgreSQL, and I am building a temporary solution for the migration period to allow my ASP.NET app to connect to my Heroku Postgres database and make use of Entity Framework etc.
So far I have managed to connect to the database from pgAdmin III for windows with no problems, but when connecting from ASP.NET app, I get this error:
CertificateUnknown: Server certificate was not accepted. Chain status: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
. The specified hostname was not present in the certificate.
I am still fairly new to heroku, but it does not make sense why I can connect from pgAdmin with the same settings as my ASP.NET app but it doesn't work in the app itself.
Full stack trace:
[ClientAlertException: CertificateUnknown: Server certificate was not accepted. Chain status: A certificate chain processed, but
terminated in a root certificate which is not trusted by the trust
provider. . The specified hostname was not present in the
certificate.]
TlsClientStream.TlsClientStream.SendAlertFatal(AlertDescription
description, String message) +44
TlsClientStream.TlsClientStream.ParseCertificateMessage(Byte[] buf,
Int32& pos) +1359
TlsClientStream.TlsClientStream.TraverseHandshakeMessages() +415
TlsClientStream.TlsClientStream.GetInitialHandshakeMessages(Boolean
allowApplicationData) +336
TlsClientStream.TlsClientStream.PerformInitialHandshake(String
hostName, X509CertificateCollection clientCertificates,
RemoteCertificateValidationCallback
remoteCertificateValidationCallback, Boolean
checkCertificateRevocation) +198
[IOException: TlsClientStream.ClientAlertException:
CertificateUnknown: Server certificate was not accepted. Chain status:
A certificate chain processed, but terminated in a root certificate
which is not trusted by the trust provider. . The specified hostname
was not present in the certificate. at
TlsClientStream.TlsClientStream.SendAlertFatal(AlertDescription
description, String message) at
TlsClientStream.TlsClientStream.ParseCertificateMessage(Byte[] buf,
Int32& pos) at
TlsClientStream.TlsClientStream.TraverseHandshakeMessages() at
TlsClientStream.TlsClientStream.GetInitialHandshakeMessages(Boolean
allowApplicationData) at
TlsClientStream.TlsClientStream.PerformInitialHandshake(String
hostName, X509CertificateCollection clientCertificates,
RemoteCertificateValidationCallback
remoteCertificateValidationCallback, Boolean
checkCertificateRevocation)]
TlsClientStream.TlsClientStream.PerformInitialHandshake(String
hostName, X509CertificateCollection clientCertificates,
RemoteCertificateValidationCallback
remoteCertificateValidationCallback, Boolean
checkCertificateRevocation) +289
Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout) +1372
Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout) +314
Npgsql.NpgsqlConnection.OpenInternal() +461
Npgsql.NpgsqlConnection.Open() +4
Npgsql.NpgsqlServices.UsingPostgresDBConnection(NpgsqlConnection
connection, Action`1 action) +162
Npgsql.NpgsqlServices.GetDbProviderManifestToken(DbConnection
connection) +99
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection
connection) +87
[ProviderIncompatibleException: The provider did not return a
ProviderManifestToken string.]
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection
connection) +271
System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices
providerServices, DbConnection connection) +27
[ProviderIncompatibleException: An error occurred accessing the
database. This usually means that the connection to the database
failed. Check that the connection string is correct and that the
appropriate DbContext constructor is being used to specify it or find
it in the application's config file. See
http://go.microsoft.com/fwlink/?LinkId=386386 for information on
DbContext and connections. See the inner exception for details of the
failure.]
System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices
providerServices, DbConnection connection) +89
System.Data.Entity.Infrastructure.<>c__DisplayClass1.b__0(Tuple3
k) +31
System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey
key, Func2 valueFactory) +62
System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection
connection) +251
System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection
connection, DbProviderManifest& providerManifest) +56
System.Data.Entity.DbModelBuilder.Build(DbConnection
providerConnection) +43
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext
internalContext) +62
System.Data.Entity.Internal.RetryLazy2.GetValue(TInput input) +123
System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
+627 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type
entityType) +18
System.Data.Entity.Internal.Linq.InternalSet1.Initialize() +53
System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext()
+15 System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider()
+38 System.Linq.Queryable.Where(IQueryable1 source, Expression1 predicate) +83
Saleboat.Logic.MeetingLogic.CheckMeetingFilter.OnActionExecuting(ActionExecutingContext
filterContext) in C:\Users\Michael\Documents\Visual Studio
2013\Projects\Saleboat\project-saleboat\Saleboat\Logic\MeetingLogic\CheckMeetingFilter.cs:22
System.Web.Mvc.Async.AsyncInvocationWithFilters.InvokeActionMethodFilterAsynchronouslyRecursive(Int32
filterIndex) +176
System.Web.Mvc.Async.AsyncInvocationWithFilters.InvokeActionMethodFilterAsynchronouslyRecursive(Int32
filterIndex) +644
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__31(AsyncCallback
asyncCallback, Object asyncState) +58
System.Web.Mvc.Async.WrappedAsyncResult1.CallBeginDelegate(AsyncCallback
callback, Object callbackState) +14
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback
callback, Object state, Int32 timeout) +128
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeActionMethodWithFilters(ControllerContext
controllerContext, IList1 filters, ActionDescriptor actionDescriptor,
IDictionary2 parameters, AsyncCallback callback, Object state) +197
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback
asyncCallback, Object asyncState) +743
System.Web.Mvc.Async.WrappedAsyncResult1.CallBeginDelegate(AsyncCallback
callback, Object callbackState) +14
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback
callback, Object state, Int32 timeout) +128
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext
controllerContext, String actionName, AsyncCallback callback, Object
state) +343
System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback
asyncCallback, Object asyncState, ExecuteCoreState innerState) +25
System.Web.Mvc.Async.WrappedAsyncVoid1.CallBeginDelegate(AsyncCallback
callback, Object callbackState) +30
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback
callback, Object state, Int32 timeout) +128
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback,
Object state) +465
System.Web.Mvc.Controller.<BeginExecute>b__14(AsyncCallback
asyncCallback, Object callbackState, Controller controller) +18
System.Web.Mvc.Async.WrappedAsyncVoid1.CallBeginDelegate(AsyncCallback
callback, Object callbackState) +20
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback
callback, Object state, Int32 timeout) +128
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext,
AsyncCallback callback, Object state) +374
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext
requestContext, AsyncCallback callback, Object state) +16
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(AsyncCallback
asyncCallback, Object asyncState, ProcessRequestState innerState) +52
System.Web.Mvc.Async.WrappedAsyncVoid1.CallBeginDelegate(AsyncCallback
callback, Object callbackState) +30
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback
callback, Object state, Int32 timeout) +128
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase
httpContext, AsyncCallback callback, Object state) +384
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext,
AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext
context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+103 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

With Npgsql 3.1.5 try to use "Trust Server Certificate=true" in connection string.
Example connection string:
Server=[servername];Port=[port];User Id=[username];Password=[password];Database=[databasename];sslmode=Require;Trust Server Certificate=true

Related

Self-built Bonobo.Git.Server Login Error: The required anti-forgery cookie "__RequestVerificationToken" is not present

I got the below error while logging in with admin/admin after first open the Bonobo server:
500 Server Error
A server error occurred when processing your request. Please try again or contact the system administrator.
Bonobo version: V6.5.0
Server: Windows Server 2016 Standard
And I have tried serial ways but no luck:
Add <httpCookies httpOnlyCookies="true" requireSSL="true"/> in web.config
Move the folder out of C:\inetpub\wwwroot;
Re-open the browser;
After googled hours in internet, it seems that the root reason is code issue. could anyone can help me out of this?
Below is the log copied from Bonobo.Git.Server\App_Data\Logs:
2020-04-22 11:54:24.061 +08:00 [Error] 500 Exception caught in Global.asax
System.Web.Mvc.HttpAntiForgeryException (0x80004005): The required anti-forgery cookie "__RequestVerificationToken" is not present.
at System.Web.Helpers.AntiXsrf.TokenValidator.ValidateTokens(HttpContextBase httpContext, IIdentity identity, AntiForgeryToken sessionToken, AntiForgeryToken fieldToken)
at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext)
at System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback asyncCallback, Object asyncState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state)
at System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
at System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
at System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state)
at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

umbraco forms posting from protected page gives ysod

Using Umbraco version 7.4.3 assembly: 1.0.5948.18141
After creating a form using umbraco 7.4.3 the form works as expected, except when we access the form via a protected page. The form displays, and allows user interaction, however we are unable to submit form from protected page.
There was a question posed on the umbraco forum that suggested a fix was found, but no information for that fix was posted here -> https://our.umbraco.org/forum/umbraco-forms/78933-umbraco-forms-and-protected-pages,
I have also posted a question regarding this issue in the umbraco forums - no answer todate.
YSOD when submitting form from a protected page. Stack trace below:
[NullReferenceException: Object reference not set to an instance of an
object.]
Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String
cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding,
CacheItemPriority priority, CacheItemRemovedCallback removedCallback,
CacheDependency dependency) +825
Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String
cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding,
CacheItemPriority priority, CacheItemRemovedCallback removedCallback,
String[] dependentFiles) +200
Umbraco.Core.Cache.DeepCloneRuntimeCacheProvider.GetCacheItem(String
cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding,
CacheItemPriority priority, CacheItemRemovedCallback removedCallback,
String[] dependentFiles) +183
Umbraco.Forms.Core.Cache.CacheProviderExtensions.GetCacheItem(IRuntimeCacheProvider
provider, String cacheKey, Func1 getCacheItem, Nullable1 timeout,
Boolean isSliding, CacheItemPriority priority,
CacheItemRemovedCallback removedCallback, String[] dependentFiles)
+541 Umbraco.Forms.Data.StringHelper.ParseMemberPlaceholders(String value, Object memberKey) +1990
Umbraco.Forms.Data.StringHelper.ParsePlaceHolders(HttpContext context,
Record record, String value) +584
Umbraco.Forms.Data.StringHelper.ParsePlaceHolders(Record record,
String value) +75
Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(List1
workflows, RecordEventArgs e) +1158
Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(Record
record, Form form, FormState state, Boolean editMode) +468
Umbraco.Forms.Web.Services.RecordService.Submit(Record record, Form
form) +704
Umbraco.Forms.Web.Controllers.UmbracoFormsController.SubmitForm(Form
form, FormViewModel model, Dictionary2 state, ControllerContext
context) +3103
Umbraco.Forms.Web.Controllers.UmbracoFormsController.GoForward(Form
form, FormViewModel model, Dictionary2 state) +339
Umbraco.Forms.Web.Controllers.UmbracoFormsController.HandleForm(FormViewModel
model, Boolean captchaIsValid) +1283 lambda_method(Closure ,
ControllerBase , Object[] ) +167
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary2 parameters) +217
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary2
parameters) +39
System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult
asyncResult, ActionInvocation innerInvokeState) +12
System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult
asyncResult) +139
System.Web.Mvc.Async.AsyncInvocationWithFilters.b3d() +112
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass46.b3f() +452
System.Web.Mvc.Async.<>cDisplayClass33.b32(IAsyncResult asyncResult)
+15 System.Web.Mvc.Async.<>cDisplayClass2b.b1c() +37 System.Web.Mvc.Async.<>cDisplayClass21.b1e(IAsyncResult asyncResult)
+241 System.Web.Mvc.Controller.b1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult
asyncResult) +111
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult
asyncResult) +19 System.Web.Mvc.MvcHandler.b__5(IAsyncResult
asyncResult, ProcessRequestState innerState) +51
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult) +111
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+606 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
There is a reply in the thread you've mentioned: https://our.umbraco.org/forum/umbraco-forms/78933-umbraco-forms-and-protected-pages#comment-256103. Hope it'll help you :)

The client and server cannot communicate, because they do not possess a common algorithm Azure Storage

For the past month I've been running a web app in azure using ASP.NET MVC (.NET 4.6).
It's all been working fine until now however all the sudden I see the following exception being thrown constantly:
Microsoft.WindowsAzure.Storage.StorageException: The underlying
connection was closed: An unexpected error occurred on a receive. --->
System.Net.WebException: The underlying connection was closed: An
unexpected error occurred on a receive. --->
System.ComponentModel.Win32Exception: The client and server cannot
communicate, because they do not possess a common algorithm at
System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface
SecModule, String package, CredentialUse intent, SecureCredential scc)
at
System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse
credUsage, SecureCredential& secureCredential) at
System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]&
thumbPrint) at
System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32
offset, Int32 count, Byte[]& output) at
System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32
offset, Int32 count) at
System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32
count, AsyncProtocolRequest asyncRequest) at
System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst,
Byte[] buffer, AsyncProtocolRequest asyncRequest) at
System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult
lazyResult) at
System.Net.TlsStream.CallProcessAuthentication(Object state) at
System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx) at
System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx) at
System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state) at
System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32
size) at System.Net.ConnectStream.WriteHeaders(Boolean async)
--- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetResponse() at
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand1
cmd, IRetryPolicy policy, OperationContext operationContext) in
c:\Program Files
(x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line
695 --- End of inner exception stack trace --- at
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand1
cmd, IRetryPolicy policy, OperationContext operationContext) in
c:\Program Files
(x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line
604 at
Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.Exists(Boolean
primaryOnly, BlobRequestOptions requestOptions, OperationContext
operationContext) in c:\Program Files
(x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Blob\CloudBlobContainer.cs:line
1406 at BoligsideUtility.ImageService.GetBlockBlob(String
containerName, String blobName) in
C:\Users\NM\Dropbox\Projects\Boligside\BoligsideUtility\ImageService.cs:line
59 at BoligsideUtility.ImageService.GetImageUrl(ResImage img) in
C:\Users\NM\Dropbox\Projects\Boligside\BoligsideUtility\ImageService.cs:line
71 at Boligside.ViewModels.ResImageVm..ctor(ResImage image) in
C:\Users\NM\Dropbox\Projects\Boligside\Boligside\ViewModels\ImageViewModels.cs:line
22 at Boligside.ViewModels.ReviewVm..ctor(Review r) in
C:\Users\NM\Dropbox\Projects\Boligside\Boligside\ViewModels\ReviewVms.cs:line
74 at Boligside.ViewModels.HomeVm.<>c.<.ctor>b__21_2(Review x) in
C:\Users\NM\Dropbox\Projects\Boligside\Boligside\ViewModels\HomeViewModel.cs:line
35 at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at
Boligside.ViewModels.HomeVm..ctor(RealestateSiteDbContext context) in
C:\Users\NM\Dropbox\Projects\Boligside\Boligside\ViewModels\HomeViewModel.cs:line
35 at Boligside.Controllers.HomeController.Index() in
C:\Users\NM\Dropbox\Projects\Boligside\Boligside\Controllers\HomeController.cs:line
129 at lambda_method(Closure , ControllerBase , Object[] ) at
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase
controller, Object[] parameters) at
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary2 parameters) at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary2
parameters) at
System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult
asyncResult, ActionInvocation innerInvokeState) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult
asyncResult) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult
asyncResult) at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.b__3f()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.b__32(IAsyncResult asyncResult) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult
asyncResult) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult
asyncResult) at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.b__1c()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.b__1e(IAsyncResult
asyncResult)
The line where the exception happens is this one:
CloudBlobContainer container = BlobClient.GetContainerReference(containerName);
In this line I essentially call the azure blob API to get the container reference of the corresponding container name.
The strange thing is; I published my project again and the error disappeared.
However, the next day (today) the error reappeared.

System.Data.SqlClient.SqlException: The SELECT permission was denied on object 'tableName', database 'dbName', schema 'dbo'

I try to SELECT some data from SQL Server via my ASP.NET MVC web-app which is hosted in a Local IIS 7 and I'm getting this error:
System.Data.SqlClient.SqlException: The SELECT permission was denied
on object 'tableName', database 'dbName', schema 'dbo'.
Knowing that all the IIS APPPOOL\ASP.NET V4.0 Integrated's privileges are checked, how do I to fix this, please?
Stack trace:
[RuntimeBinderException: Cannot perform runtime binding on a null
reference] CallSite.Target(Closure , CallSite , Object ) +200
System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0
arg0) +924 ASP._Page_Views_Shared__Header_cshtml.Execute() in
c:\Users\Nectarys\desktop\monitoringn_web\monitoring2 -
copy\monitoringn\Views\Shared_Header.cshtml:11
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper,
String partialViewName, Object model, ViewDataDictionary viewData)
+158 ASP._Page_Views_Shared__Layout_cshtml.Execute() in c:\Users\Nectarys\desktop\monitoringn_web\monitoring2 -
copy\monitoringn\Views\Shared_Layout.cshtml:13
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
System.Web.WebPages.WebPageBase.Write(HelperResult result) +89
System.Web.WebPages.WebPageBase.RenderSurrounding(String
partialViewName, Action1 body) +233
System.Web.WebPages.WebPageBase.PopContext() +291
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
+378 System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
+33 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext preContext, Func1 continuation)
+855148 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
controllerContext, IList`1 filters, ActionResult actionResult) +265
System.Web.Mvc.Async.<>c_DisplayClass25.b_22(IAsyncResult
asyncResult) +839620
System.Web.Mvc.<>c_DisplayClass1d.b_18(IAsyncResult
asyncResult) +28
System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult
ar) +15 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult
asyncResult) +65
System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult
ar) +15 System.Web.Mvc.Controller.EndExecute(IAsyncResult
asyncResult) +51
System.Web.Mvc.<>c_DisplayClass8.b_3(IAsyncResult
asyncResult) +42
System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult
ar) +15 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult
asyncResult) +51
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+606 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Also, I've grant SELECT,INSERT,UPDATE,DELETE on dbo.tableName to "IIS APPPOOL\ASP.NET V4.0 Integrated";. I've did this by selecting the dbName and making in new script in which I've written that line.
Your db user do not have rights to read from table's in db. You can give it db_owner rights and it should work.
Login to SQL server
Go to your database --> expand it
Security--> your db user
Right Click--> properties
Make sure that db_owner is selected
I had a different issue.
I already had done changing permissions to 'db_owner', but it still didn't fix my problem.
Then I changed DefaultAppPool to 'NetworkService' in IIS Manager. It fixed my issue.

ASP.NET MVC large number of file uploads dropped

We are hosting ASP.NET MVC app on Windows 2008 with IIS 7.5, 3 cores CPU(all usage ~60%) and 2GB of RAM. The w3wp.exe for the web app show ~700,000K of memory usage in task manager. Physical memory information is Total 2043, Cached ~600, Available ~611, Free ~20.
The web app accept large number of file uploads per minute. About ~20 files per minute. The file size range vary from 100kb to 10mb. We have noticed that many file uploads are dropped. While looking at HTTP request information we find that Content-Length and TotalBytes values are different.
The maxRequestLength is set to 81920 and executionTimeout 1200
<httpRuntime targetFramework="4.5" maxRequestLength="81920" executionTimeout="1200" />
Queue Length for app pool is set to 5000
We do not get any error in event viewer, we use custom file binder like this
[HttpPost]
public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> clientUpload, [OptionModelBinder]IOptionViewModel formData)
{
//...
}
and get error in ASP.NET like this
System.ArgumentNullException: Value cannot be null.
Parameter name: name
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at PC.Controllers.OptionModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)
at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
at System.Web.Mvc.Async.AsyncResultWrapper.Begin[TResult](AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout)
at System.Web.Mvc.Async.AsyncResultWrapper.Begin[TResult](AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
at System.Web.Mvc.Async.AsyncResultWrapper.Begin[TResult](AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout)
at System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
at System.Web.Mvc.Async.AsyncResultWrapper.Begin[TResult](AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout)
at System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag)
at System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
at System.Web.Mvc.Async.AsyncResultWrapper.Begin[TResult](AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout)
at System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag)
at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
The custom binder receive request but with partial upload data because Content-Length and TotalBytes do not match.
Maybe someone has any idea where the problem could be and where to start looking?
You have set maxRequestLength="81920", i.e. 80 mb. You have already mentioned large request may span to 100 mb, also Content-Length and TotalBytes are different. Please check if only those requests are failing those exceed size limit. If so, please increase maxRequestLength.

Resources