Skip to main content

D365FO: How to debug a non-development and a non-production environment

This post outlines the steps how to debug an issue which is happening in non-development or non-production environments e.g. UAT environment.




1.    RDP to your environment where you want to debug the issue, with this example I am connecting to UAT (Sandbox). 
2.    Connect to SQL server
a.     Get the server name from LCS database accounts
b.    Use .database.windows.net to connect to database


3.    Create a new SQL sign-in that the developer can use. This step lets the system administrator maintain the security of the sandbox environment. The developer will have access to one database for only a limited time. Use the following code to create the new SQL sign-in.

CREATE USER devtempuser WITH PASSWORD = 'pass@word1'
EXEC sp_addrolemember 'db_owner', 'devtempuser'

4.    Stop following services in development box
a.     IIS or world wide web publishing service development box
b.    Microsoft Dynamics 365 unified Operations: Batch Management service

5.    Go to J:\AosService\WebRoot\web.config.
6.    Save a copy of the original web.config file, so that you can switch back later. I copied file in the same directory and renamed the web.config to webDev.config and copied one to web.config
7.    Edit the following section in the web.config file.
Before your changes
<add key="DataAccess.Database" value="AxDB" />
<add key="DataAccess.DbServer" value="devDbServerName" />
<add key="DataAccess.SqlPwd" value="password" />
<add key="DataAccess.SqlUser" value="axdbadmin" />
After your changes
<add key="DataAccess.Database" value="sandboxdatabaseServerName" />
<add key="DataAccess.DbServer" value=" sandboxdbName.database.windows.net" />
<add key="DataAccess.SqlPwd" value="P@ssw0rd" />
<add key="DataAccess.SqlUser" value="devtempuser" />

8.    Start IIS or world wide web publishing service
9.    Do not start batch service otherwise your batch jobs of development box will start writing into UAT environment. Be careful with this step!!!
10.  Now, connect to your development box from browser. Oops!!! It does not connect and throw an error. Don’t worry let’s jump into event log and see what’s in there



Okay; so it is an access issue and here is the resolution for it.

11.  Execute the following command against Master database in UAT database server. IP address you get from the event viewer.

exec sp_set_firewall_rule N'PPDEV01', '13.70.85.22', '13.70.85.22'



Note: Restart IIS and make sure application pool is started

12.  Connect to development URL again from browser and this time it works. You can now access UAT database (all legal entities etc.)
13.  Restart or your start your VS in development box and attach to Process w3wp.exe to troubleshoot the issue(s)

Done with your debugging and got the resolution J

14.  Now it is time to remove devtempuser from UAT database, this prevents having the permanent access to the sandbox database. Right-click on the devtempuser user under Sabndoxdatabase | Security | Users and delete it.

15.  Stop IIS.

16.  Revert changes from the web.config file or simply delete the copied one and rename the original one from WebDev to Web.

17.  Start IIS.

18.  Start batch service 

19.  Connect to development environment URL and make sure it is connected to development database.

Reference: 
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-tools/debugx-issue-against-copy-of-production

Comments

  1. Hi, Thanks for the pretty well documented step-by-step procedure.

    One important aspect of debugging is to work with the correct version of the application. This means somewhere in one of the steps, you do need to get the correct version from the source control before you start the debugging.

    This can be done by getting the specific version dialog that let's you get the source code labeld with the same version as the one you have in your T2 environment.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi Daxture,
    useful info. thanks for the post!
    http://www.godparticles.in/

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hi ,

    I followed the steps given.

    I am getting error.

    Sorry, the server has encountered an error. It is either not available or it can't respond at this time. Please contact your system administrator.

    Error 500.

    And in event Viewer it shows:


    Event code: 3007
    Event message: A compilation error has occurred.
    Event time: 7/5/2019 9:07:12 AM
    Event time (UTC): 7/5/2019 9:07:12 AM
    Event ID: b9f480dc2ceb417095b61637d4c52079
    Event sequence: 3
    Event occurrence: 1
    Event detail code: 0

    Application information:
    Application domain: /LM/W3SVC/2/ROOT-1-132067912317932822
    Trust level: Full
    Application Virtual Path: /
    Application Path: K:\AosService\WebRoot\
    Machine name: ALT-DEV1-1

    Process information:
    Process ID: 15148
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE

    Exception information:
    Exception type: HttpCompileException
    Exception message: k:\AosService\WebRoot\App_Code\LocalizationController.cs(89): error CS0103: The name 'WebClientEventSource' does not exist in the current context
    at System.Web.Compilation.AssemblyBuilder.Compile()
    at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
    at System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed)
    at System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories)
    at System.Web.Compilation.BuildManager.CompileCodeDirectories()
    at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
    at System.Web.Compilation.BuildManager.CallAppInitializeMethod()
    at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)



    Please suggest!

    ReplyDelete

Post a Comment

I will appreciate your comments !

Popular posts from this blog

D365O - How to add financial dimension in grid

This post outlines the steps; how to add financial dimensions (segmented control) in a grid in D365O. Let's assume we are adding new table and form for below explanation; New table contains two fields  AccountType and  LedgerDimension with relation to DimensionAttributeValueCombination table  Form looks like this; Set properties for segmented control under form design; - Auto declaration = Yes - Account type field = AccountType - Controller class = DimensionDynamicAccountController - Filter expression = %1 1. Override modified method for LedgerDimension field under form's datasource 2. Override lookup and checkUserCustomLookup method on ledger dimension segmented control in form desgin Datasource | D365O_FinancialDimension | LedgerDimension | modified [DataSource]     class D365O_FinancialDimension     { ...

The Dual Write implementation - Part 1 - Understand and Setup

What is Dual-write? Tightly couples – complete at one transaction level Near real time Bi-directional Master data and business documents – Customer records you are creating and modifying and at this document we are talking about sales orders or quotes and invoice. Master data could be reference data e.g. customer groups and tax information Why Dual-write and why not Data Integrator? Data Integrator is Manual or Scheduled One directional Now, Let's deep dive and understand what is required for Dual-write setup and from where to start. First thing first, check you have access to https://make.powerapps.com/ Choose right environment of CDS (CE) Make sure you have access to the environment too, click on gear icon and Admin Center  Look for required environment and Open it, you must have access as going forward you are going to configure dual write steps in the environment user the same user you are logged in now. Now, go back to power platform admin center and...

Another step closer - Finance Operations data in Power Platform - Virtual Entities

This post focuses on the integration technologies available to have the Microsoft Dynamics 365 Finance Operations data available in Dataverse/Common Data Services/CDS. What could be better then having The biggest ERP system's data in Power Platform. You can Power Portals, Power Apps, Power BI analytical reports, use power virtual agents for inventory closing and year end closing processes, manage expenses and employee/contractors time entry processes, most of these processes can be even without logging to MS ERP (Dynamics 365 Finance Operation) so can safe on license cost too.  Let's see what options are available to integrate F&O data with Power Platform however, this post is dedicated to Virtual Entities.  3 Options available out-the-box to integrate F&O data with Power Platform; 👉  Data Integrator  - Click on link to read more 👉  Dual-Write  -  Click on link to read more 👉  Virtual Entities - MS Tech Talk on Virtual entities   ...