How to get the AOS host URL through code

Could anyone help me on taking the AOS host url through code.

Unfortunately you forgot to attach a version tag, therefore we don’t know which version of AX you’re talking about.

If it’s about F&O and you’re interested of the URL of the environment (which may consist of multiple AOS servers), try this:

var env = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();
str domainName = env.Infrastructure.FullyQualifiedDomainName;

Also, please use the type of thread ‘Question and answer post’ for your questions. Let me fix it for you, so we can track suggested and verified answers for your question.

Sure Martin…

Its for D365 FO, will check it and let me update you the output.

Thanks for your valuable reply.