Issue with Sitefinity 7.3 on azure webrole - asp.net-mvc

I am migrating a sitefinity application onto an azure web role. The database is already migrated to sql azure. And with that connectionstring in DataConfig.config the application runs fine in my local machine. But once I add a cloud project and (made the necessary changes mentioned in telerik documentation - azure assemblies redirection,dataconfig change,app.dll.config file , internal endpoint, local storage) and set this application as a web role it does not work. When I run the cloud project in azure emulator locally or deploy as a cloud service I get the following error.
Enum conversion failed as the property/field is not nullable and no
value has been read from the database. 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.InvalidOperationException: Enum conversion
failed as the property/field is not nullable and no value has been
read from the database.
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:
[InvalidOperationException: Enum conversion failed as the
property/field is not nullable and no value has been read from the
database.] OpenAccessRuntime.Data.EnumConverter.Read(DataHolder&
holder) +470
OpenAccessRuntime.Relational.RelationalGenericState.copyPass1Fields(ResultSet
rs, FetchGroupField[] fetchGroups, Int32 firstCol) +346
[DataStoreException: Error reading field
Telerik.Sitefinity.Forms.Model.FormDraft.k__BackingField
from ResultSet: System.InvalidOperationException: Enum conversion
failed as the property/field is not nullable and no value has been
read from the database. at
OpenAccessRuntime.Data.EnumConverter.Read(DataHolder& holder) at
OpenAccessRuntime.Relational.RelationalGenericState.copyPass1Fields(ResultSet
rs, FetchGroupField[] fetchGroups, Int32 firstCol)
System.InvalidOperationException: Enum conversion failed as the
property/field is not nullable and no value has been read from the
database. at OpenAccessRuntime.Data.EnumConverter.Read(DataHolder&
holder) at
OpenAccessRuntime.Relational.RelationalGenericState.copyPass1Fields(ResultSet
rs, FetchGroupField[] fetchGroups, Int32 firstCol)]
DynamicModule.ns.Wrapped_OpenAccessFormsProvider_f4f053b2c49247a8908c30d75bf02970.GetForm(Guid formId) +413
Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl.get_FormData()
+759 Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl.ProcessFormInitialization()
+21 Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl.InitializeControls(GenericContainer
container) +55
Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +88
System.Web.UI.Control.EnsureChildControls() +189
System.Web.UI.Control.PreRenderRecursiveInternal() +60
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+4297
I checked the telerik forum as well and found only 2 posts with this error but the solutions suggested did not work.
any solutions to resolve this issue will be helpful.

After adding assembly redirect for all the telerik dlls and other third party DLLs in web. Config and app.DLL.config I also ran 3 update scripts mentioned in sitefinity forum in the db. This fixed the issue and site came up.

Related

Error in Azure when a Web App tries to insert into a SQL Server database for the first time after tables created

This is a question that involves Azure with SQL Server and a Web App.
Everything works fine locally. The problem exists only in Azure.
I have set up a SQL Server with a database, and published a web app. They are using the same region.
Everything has default settings, except for allowing my local ip to connect to the database server.
I can connect to Azure SQL Server from SQL Server Management Studio and I see my database there.
The first thing I do in the web app is trying to register a new user. The tech involved is ASP.NET MVC5, ASP.NET Identity, and Entity Framework with migration scripts. Normal MS stuff.
I have set the ApplicationDbContext(DefaultConnection) in the Publish/Settings/Databases dialog and checked "Execute Code First Migrations".
The migration script is running fine. All tables have been created and are showing up in SQL Server Management Studio.
But when the web app is trying to add a new user to the User table, I get the error shown below.
So.. The web app obviously has a connection and access rights to the database since all tables have been created. Any idea what I am missing?
Thanks for any help and input!
Update:
In the web.config I found a new ConnectionString:
DefaultConnection_DatabasePublish with the correct configuration.
Somehow the original DefaultConnection was changed to Data Source=localhost;Initial Catalog={catalog};Integrated Security=True after it was published.
Changing the DefaultConnection to the same as DefaultConnection_DatabasePublish resolved the issue.
I have not had this behavior before when publishing. I have not checked "Execute Code First Migrations" before. Can someone confirm if the behavior is related to that?
Server Error in '/' Application.
The system cannot find the file specified
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 system cannot find the file specified
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 system cannot find the file specified]
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
System.Data.SqlClient.SqlInternalConnectionTds.. ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +821
System.Data.SqlClient.SqlConnectionFactory.CreateConnection (DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +332
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection (DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +699
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +89
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +426
System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen() +343
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter. HandleNonSuccessAndDebuggerNotification(Task task) +58
System.Data.Entity.SqlServer.<b__3>d__6.MoveNext() +226
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter. HandleNonSuccessAndDebuggerNotification(Task task) +58
System.Data.Entity.SqlServer.d__9`1.MoveNext() +354
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter. HandleNonSuccessAndDebuggerNotification(Task task) +58
System.Data.Entity.Core.EntityClient.d__8.MoveNext() +594
According to your description and error message, I guess you don't set the right connection string in web.config.
So the web app couldn't access the right sql database.
I suggest you could try to use kudu console to check the web app have set the right connection string.
1.Open the kudu console.
2.Use debug console
3.Locate the site\wwwroot folder and find web.config file.
Click the modify button.
4.Then you could find the connection string.
Replace the right connection string with the old one.
The connection string format is as below:
Server=tcp:{sqlservername}.database.windows.net,1433;Initial Catalog={databasename};Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
Or you could directly set the connection string in azure web app's Application settings.

TFS build failing because of registry access is not allowed

I am configuring New bulid server I am having TFS 2013. I am an admin on the build server and the account which is used for configuring build server is also a admin on build server.
I am able to access my TFS and able to Checkin code as well from build server.
I don't know what access rights I have to give to my user or to the account used for configuring build server.
Exception Message: Requested registry access is not allowed. (type SecurityException)
Exception Stack Trace:
Server stack trace:
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.TeamFoundation.Common.Internal.TeamFoundationEnvironment.OpenOrCreateRootUserRegistryKey()
at Microsoft.TeamFoundation.VersionControl.Client.Workstation.get_AttemptToAutoResolveConflicts()
at Microsoft.TeamFoundation.VersionControl.Client.Client.Get(Workspace workspace, GetRequest[] requests, GetOptions options, GetFilterCallback filterCallback, Object userData, String[] itemAttributeFilters, String[] itemPropertyFilters, Boolean alwaysQueryConflicts, Conflict[]& conflicts, Int32 operationId)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.Get(GetRequest[] requests, GetOptions options, GetFilterCallback filterCallback, Object userData, String[] itemAttributeFilters, String[] itemPropertyFilters, Boolean alwaysQueryConflicts, Conflict[]& conflicts)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.Get(GetRequest[] requests, GetOptions options, GetFilterCallback filterCallback, Object userData)
at Microsoft.TeamFoundation.Build.Workflow.Activities.TfGet.TfGetCore.RunCommand(VersionControlScope versionControlScope, Workspace workspace, String getting, String nonFatalError, String version, String fileSpec, GetOptions options, RecursionType recursion)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at System.Func`9.EndInvoke(IAsyncResult result)
at Microsoft.TeamFoundation.Build.Workflow.Activities.TfGet.TfGetCore.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity`1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
The service account configured for the build service needs the rights. The TFS service and the build service may or may not be configured to run under the same account. Your personal account is not part of this equation.
MSDN outlines the permissions required for each service account here https://msdn.microsoft.com/en-us/library/ms253149(v=vs.120).aspx Look at the entry for TFSBuild
The setup is also outlined in https://msdn.microsoft.com/en-gb/library/ms181712(v=vs.120).aspx and explains how to pick what type of account you should choose when setting up your build server

Error registering ApplicationInsights WebRequestTrackingModuleRegister when publishing to Azure

I am trying to publish a web app into Azure. It publishes successfully but I get a runtime error when hitting a page.
Here is the stack trace:
[ArgumentNullException: Value cannot be null.
Parameter name: moduleType]
System.Web.DynamicModuleRegistry.Add(Type moduleType) +304
System.Web.HttpApplication.RegisterModule(Type moduleType) +65
Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(Type moduleType) +36
Microsoft.ApplicationInsights.Extensibility.AzureWebSites.WebRequestTrackingModuleRegister.Register() +38
[InvalidOperationException: The pre-application start initialization method Register on type Microsoft.ApplicationInsights.Extensibility.AzureWebSites.WebRequestTrackingModuleRegister threw an exception with the following error message: Value cannot be null.
Parameter name: moduleType.]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +586
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +129
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +163
System.Web.Compilation.BuildManager.ExecutePreAppStart() +156
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +621
[HttpException (0x80004005): The pre-application start initialization method Register on type Microsoft.ApplicationInsights.Extensibility.AzureWebSites.WebRequestTrackingModuleRegister threw an exception with the following error message: Value cannot be null.
Parameter name: moduleType.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +660
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +96
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189
I'm not sure what the reason is for this. I simply added the nuget package for App Insights for Web Applications and then updated the InstrumentationKey in the AppInsights.config file included in the project. These are the same steps I have used before to get it working but this time it produces this strange result!
Anybody ran into this before?
I ran into this same issue when setting up a second site for AppInsights on Azure. The first site was setup a few months ago using version 0.16.1-build00418 (prerelease) and everything worked fine. Just today I setup a second Azure site using version 1.1.0 and ran into the same error you got.
While I don't know the exact cause I was able to solve the issue by completely deleting the content of the site and then re-publishing.
The only way I know how to fully delete the site content is by FTPing to the site. You can get the FTP connection information by downloading the publish profile for the site from the Azure portal. Then delete everything under /site/wwwroot and re-publish.

Umbraco v6 Deploy to production server getting DB exception, content and media trees not loading

We just deployed a new v6 site to a host that has several v4 sites running on it no problem. On the front end, it looks fine, but in the Umbraco admin the Content and Media trees appear empty.
In the browser debugger I can see that there is an error in the TreeDataService.ashx.
The error is below and I'm not exactly sure what the issue is. Is it permissions? Database user permissions?
----------
You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider
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: You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider
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:
[ArgumentNullException: You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider]
Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig.get_SqlSyntaxProvider() +89
Umbraco.Core.Persistence.Mappers.BaseMapper.GetColumnName(Type dtoType, PropertyInfo dtoProperty) +57
Umbraco.Core.Persistence.Mappers.ContentMapper.Map(String propertyName) +67
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitMemberAccess(MemberExpression m) +112
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +101
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitBinary(BinaryExpression b) +258
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +159
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitLambda(LambdaExpression lambda) +120
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +72
Umbraco.Core.Persistence.Querying.Query`1.Where(Expression`1 predicate) +20
Umbraco.Core.Services.ContentService.GetChildren(Int32 id) +312
umbraco.cms.businesslogic.web.Document.GetChildrenForTree(Int32 NodeId) +39
umbraco.cms.presentation.Trees.BaseContentTree.Render(XmlTree& Tree) +27
umbraco.loadContent.Render(XmlTree& tree) +19
umbraco.presentation.webservices.TreeDataService.LoadTree(TreeRequestParams treeParams) +79
umbraco.presentation.webservices.TreeDataService.GetXmlTree() +140
umbraco.presentation.webservices.TreeDataService.ProcessRequest(HttpContext context) +55
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
check you umbraco db connection string.
<add name="umbracoDbDSN".......
if it do contains
providerName="System.Data.SqlClient"
then Add it and check. the same. it might start working.
Problem is that SqlSyntaxProvider is null, my workaround is init it.
var service = new Umbraco.Core.Services.ContentService();
SqlSyntaxContext.SqlSyntaxProvider = new MySqlSyntaxProvider();
The connection string, add name="umbracoDbDSN" ... was missing the following providerName="System.Data.SqlClient"
Once I added that to the line things started working.

2 asp.net mvc sites conflicting with each other

i have deployed an asp.net mvc site a few days ago and everything is going fine. I just deployed a second website (totally unrelated)
i just went to the first website and i am now getting an error below. Can anyone help me determine what is going on. I dont understand why they would know anything about each other.
The controller name 'Home' is ambiguous between the following types:
Site.netmvc.Controllers.HomeController
SalemGolf.Controllers.HomeController
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.InvalidOperationException: The controller name 'Home' is ambiguous between the following types:
Site.netmvc.Controllers.HomeController
SalemGolf.Controllers.HomeController
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:
[InvalidOperationException: The controller name 'Home' is ambiguous between the following types:
Site.netmvc.Controllers.HomeController
SalemGolf.Controllers.HomeController]
System.Web.Mvc.DefaultControllerFactory.GetControllerTypeWithinNamespaces(String controllerName, HashSet`1 namespaces) +417
System.Web.Mvc.DefaultControllerFactory.GetControllerType(String controllerName) +286
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +57
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase h
Make sure you don't have the assembly of the other site in your Bin directory.

Resources