How to debug deployment to DXC of a hello world "alloy" app.

Vote:
 

I setup VS 2019 as per EPiServer instructions and got Alloy working locally.

Our organisation setup a DXC subscription, and I was sent the publish details for the integration env.

I followed the exact instructions here:  https://world.episerver.com/digital-experience-cloud-service/deploying/creating-a-new-cms-site-and-deploying/

If I hit plublish, I see this in the output window:

2>Adding child sitemanifest (E:\dev\xxx\epi_projects\Alloy1\obj\Release\Package\PackageTmp).
2>Adding child sitemanifest (E:\dev\xxx\epi_projects\Alloy1\obj\Release\Package\PackageTmp).
2>Adding child sitemanifest (E:\dev\xxx\epi_projects\Alloy1\obj\Release\Package\PackageTmp\App_Data).
2>Publish Succeeded.
2>Web App was published successfully http://rnkg0xxxxxxxinte.dxcloud.episerver.net/

The publish was intant (less than 1 sec) which seems odd, however, the integration DXC site has gone from a dummy welcome page to the following:

Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

I tried adding <customErrors mode="Off"/> to the existing system.web section in the existing Web.config, saved it, then rebuilt and replublished, but get same error.

I tried looking in application insights, but strangely, under deployments there is no record of my deployment, and under logs is nothing - no logs.

Under "activity log" and "quick insights" there is nothing for "failed deployemnts" nor "errors"

How can I debug this?  The publish from VS did someting (as now I get an error message on the integration website), but there seems to be no record of it, and no errors.

Any help appreciated.

#216603
Edited, Feb 10, 2020 19:40
Vote:
 

Do you have a web.release.config that set the setting to On?

#216604
Feb 10, 2020 20:32
nutmix - Feb 10, 2020 21:08
@quan Mai, there is no mention of web.release.config in the instructions here: https ://world.episerver.com/digital-experience-cloud-service/deploying/creating-a-new-cms-site-and-deploying/
Quan Mai - Feb 10, 2020 21:14
that's the thing, you should check if you have one in your project and remove that
nutmix - Feb 11, 2020 14:36
Hi, no, there is no web.release.config. I am using a brand new alloy project with no modifications.
Vote:
 

I just went through the exact steps from scrach again.  Again the project compiled no problem, and published with no errors.  But when I go to the website I get: "The page cannot be displayed because an internal server error has occurred."  When are these errors logged? There is nothing in application insights.  The only difference between this attemp and the first attempt, is that this attempt, when I created the Alloy project, I unticked the search options as per the instructions (the first attempt I tried to publish an existing Alloy demo project, which had the default search options selected).  However, neither work. I follwed the instructions to the exact letter, expcept where the UI has changed considerably becaues these in structions are based on an onld verison of CMS, unfortunately.

#216606
Edited, Feb 10, 2020 21:10
Vote:
 

Do you have access to the PAAS Portal?

If you do and have set up the logging according to:
https://world.episerver.com/documentation/developer-guides/CMS/logging/logging-into--net-diagnostics-trace/

and also this
https://world.episerver.com/digital-experience-cloud-service/development-considerations/logging/

Then you should be able to see it in the PAAS Portal.

If not, contact support support@episerver.com and ask then for the logs.


#216918
Feb 11, 2020 7:53
Vote:
 

Yes, I have access to paasportal, which I undestand is just for pushing from integratoin to preprod to prod - nothting to do with publishing from VS to Integration.

I see it has the ability to download logs. I see this error in the logs. Any idea what this error means, and how to fix?  There is no mention of cmdlet in the instructions.

System.NotSupportedException: The database schema for 'CMS' is not installed. Update the database manually by running the cmdlet 'Initialize-EPiDatabase' in the package manager console or set createDatabaseSchema=""true"" on episerver.framework configuration element.
at EPiServer.Data.SchemaUpdates.Internal.DatabaseSchemaManagerImplementation.ThrowCreateDatabaseException(String displayName)
at EPiServer.Data.SchemaUpdates.Internal.DatabaseSchemaManagerImplementation.EnsureDatabaseSchema(DataAccessOptions dataAccessOptions)
at EPiServer.Data.DataInitialization.Initialize(InitializationEngine context)
at EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key)
at EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context)
at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()",

#216950
Feb 11, 2020 14:24
Vote:
 

OK, I found several other people with the same error (I guess the documentation "Creating a new CMS site and deploying" is wrong or missing a step).

One published solution was to add <episerver.framework updateDatabaseSchema="true"> in the web.config. I did this, and now in the paas logs I see:

Skip: objectName="^configProtectedData$""
Provider: auto, Path: 
A tracing deployment agent exception occurred that was propagated to the client. Request ID 'e35331c8-f5aa-4baf-b23c-22c0d302735c'. Request Timestamp: '11/02/2020 14:27:25'. Error Details:
ERROR_SQL_EXECUTION_FAILURE
Microsoft.Web.Deployment.DeploymentDetailedClientServerException: An error occurred during execution of the database script. The error occurred between the following lines of the script: "15" and "22". The verbose log might have more information about the error. The command started with the following:
""CREATE TYPE [dbo].[AddApprovalTable] AS TABLE (""
 The type 'dbo.AddApprovalTable' already exists, or you do not have permission to create it. http://go.microsoft.com/fwlink/?LinkId=178587  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SQL_EXECUTION_FAILURE. ---> System.Data.SqlClient.SqlException: The type 'dbo.AddApprovalTable' already exists, or you do not have permission to create it.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.Web.Deployment.DBStatementInfo.Execute(DbConnection connection, DbTransaction transaction, DeploymentBaseContext baseContext, Int32 timeout)
   --- End of inner exception stack trace ---
   at Microsoft.Web.Deployment.DBStatementInfo.Execute(DbConnection connection, DbTransaction transaction, DeploymentBaseContext baseContext, Int32 timeout)
   at Microsoft.Web.Deployment.DBConnectionWrapper.ExecuteSql(DBStatementInfo sqlStatement, DeploymentBaseContext baseContext, Int32 timeout)
   at Microsoft.Web.Deployment.SqlScriptToDBProvider.AddHelper(DeploymentObject source, Boolean whatIf)
   at Microsoft.Web.Deployment.DeploymentObject.AddChild(DeploymentObject source, Int32 position, DeploymentSyncContext syncContext)
   at Microsoft.Web.Deployment.DeploymentSyncContext.HandleAddChild(DeploymentObject destParent, DeploymentObject sourceObject, Int32 position)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable, Nullable`1 syncPassId, String syncSessionId)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleSync(DeploymentAgentAsyncData asyncData, Nullable`1 passId, String user, String siteName)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleRequestWorker(DeploymentAgentAsyncData asyncData)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleRequest(DeploymentAgentAsyncData asyncData)
",4edda355-4f47-499e-a630-73354c6706ae
#216952
Feb 11, 2020 14:33
Vote:
 

Well, it used to be like that but now it has a lot of functions that you need.

It sounds like the init SQL script is not run on your database

Did you do this step?

Read more here
https://world.episerver.com/digital-experience-cloud-service/deploying/creating-a-new-cms-site-and-deploying/

#216959
Feb 11, 2020 14:56
nutmix - Feb 11, 2020 18:28
Yes, I did this step. I followed the instructions to the letter. I did exactly what it said in that article, and tried it twice in case I missed something, and got same result.. I can only guess that the article is old, and things have changed. The question is, how do you deploy a brand new Alloy site now?
Vote:
 

An alternative is to run initialize-epidatabase in VS Package Console Manager before pushing the database

#216960
Feb 11, 2020 14:59
nutmix - Feb 11, 2020 17:16
Hi, could you elaborate? I dont know how to run this.
Vote:
 

Is there any way to see if the database is actually on the integration server?  E.g. any way to connect to it remotely, or some tool to view the tables?

#216969
Feb 11, 2020 17:17
Vote:
 

From what it seems, the database has already been created on the server which is why you are unable to create new tables with the same name.

Are you able to browse to ~/episerver? Maybe it's the issue with the home page not configured under Admin > Manage Sites?

#216976
Feb 11, 2020 18:51
nutmix - Feb 11, 2020 20:09
Unfortunately /episerver also gives Server Error in '/' Application. its just an out of the box Alloy project - and works when run locally (or it did prior to making the required changes in order to deploy it as per the instructions.
Vote:
 

Update.

I tried to deploy again, this time removing  <episerver.framework updateDatabaseSchema="false"> and unticking "update database" in the publish dialog.  Now I get this when I try to browse the site:

Server Error in '/' Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>
#216980
Feb 11, 2020 20:14
Vote:
 

With a lot of help from an episerver expert, we got a "hello world" alloy project to deploy to integration.

There are several manual steps you need to do in addition to the instructions here: https://world.episerver.com/digital-experience-cloud-service/deploying/creating-a-new-cms-site-and-deploying/

1) to ceate the database.

It was not possible to create the database via the publish profile, nor via  <episerver.framework updateDatabaseSchema="true">.

The only way which worked was to use  Update-EPiDatabase command and hard code the azure connedtion strings in to the web.config.

<connectionStrings>
<add name="EPiServerDB" connectionString="Data Source=xxxx.database.windows.net,1433;Initial Catalog=epicms;User Id=epiuser@xxx;Password=xxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
<add name="EPiServerAzureBlobs" connectionString="DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxx==;" />
<add name="EPiServerAzureEvents" connectionString="Endpoint=sb://xxx.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xxxxx" />
</connectionStrings>

These connection strings must be retrieved from the "App service" resource for your environment in portal.azure.com.  Under "settings"->"Configuratoin" on the left nav, then ou will see "connection strings" at the bottom of the page on the right. You need the DB, Azure events and Azure blobs to get it working.

You have to untick the "update database" in the publish dialog. We could not get this to work with the provided documentation.

2) add "Remove additional files at destination" in the settings section of the publish profile. This is critical.

3) you have to get episerver to whitelist your public IP with the target integration environment for Update-EPiDatabase to work.

4) make sure you have EPiServer.Azure package installed.

5) when you deploy or hit the site, make sure you are running the log stream so you can see errors.  In https://paasportal.episerver.net/ for your subscriptoin, select "troubleshoot" then "open log stream window" for your integation env.

6) you will want to add custom errros in the Web.config so you can see what the actual error is on the page:

<system.web>
   <customErrors mode="Off" />

#217016
Feb 12, 2020 17:33
Vote:
 

Hi nutmix

Glad to see you finally get it working. I tried response your thread a few times, but my browser (new Microsoft Edge) got crashed every time I submitted. 

Has your company bought Developer training subscription? If yes, I highly recommend you watch Developing for DXC Service . You'll learn everything as you need to set up, deploy and working your project on DXC. Most of the issues you've been through are covered in the training material e.g. how to deploy database first time, what azure packages need to be installed in your solution to get it working on DXC, what transformation you'll need for working on both local and DXC environment etc. 

/V

#217021
Feb 13, 2020 4:21
johnv - Feb 13, 2020 11:37
Sadly, there is no training budget in our Org, so we have to make do with the available documentation, which is sometimes less than perfect.
Vincent - Feb 14, 2020 0:37
Hi Johnv, the developer training subscription cost comparing to the time spent in troubleshooting is almost nothing. In addition, there are additional useful information and gotchas covered in the training, it's definitely worth to advise your business to get it for your team. p.s. I'm not a sales guy :)
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.