Sandeep Gupta
Sandeep Gupta

Reputation: 127

Deploying wordpress app in Azure virtual directory with asp.net app

I have ASP.net app hosted on Azure websites on root. I created a virtual directory for blogs where I want to host wordpress app. I deployed the wordpress app but after (wordpress admin panel) login click it redirects to error page of my asp.net app. The frontend (blog pages) is also not visible.

I assume there might be some URL rewrite issue in Web.config. Also need to change something in wordpress settings. I am not sure.

Update: I am getting below error when trying to access /blog

Could not load file or assembly 'AjaxControlToolKit' or one of its dependencies. The system cannot find the file specified.

Web.config in wwwroot folder

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxQueryString="32768" />
      </requestFiltering>
    </security>
  </system.webServer>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="50000000" />
      </webServices>
    </scripting>
  </system.web.extensions>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
  <system.web>
    <!-- Remove httpcookies in production -->
    <httpCookies httpOnlyCookies="true" requireSSL="false" />
    <customErrors mode="Off" />
    <authentication mode="None" />
    <compilation targetFramework="4.5">
      <assemblies>
        <add assembly="AjaxControlToolKit" />
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5" />
    <pages>
      <controls>
        <add assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagPrefix="ajaxToolkit" />
      </controls>
    </pages>
  </system.web>
  <system.webServer>
    <defaultDocument>
      <files>
        <clear />
        <add value="home.htm" />
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>

Upvotes: 1

Views: 731

Answers (2)

Sandeep Gupta
Sandeep Gupta

Reputation: 127

Finally I solved my issue. I referred to below article to create & host wordpress blog in virtual directory. To fix the "Could not load AjaxControlToolKit.dll" issue, I created a Bin folder within Wordpress folder next to wp-admin and added same dll file there. It's working now. I know it is not the right way to fix it but at this moment I could not find the root cause for same.

https://blogs.msdn.microsoft.com/kaushal/2014/04/19/microsoft-azure-web-sites-deploying-wordpress-to-a-virtual-directory-within-the-azure-web-site/

I did not use above mentioned (in first post) web.config. I just used the default one created through the process mentioned in the article.

Upvotes: 1

viperguynaz
viperguynaz

Reputation: 12174

I'd recommend putting your asp.net app in a folder under wwwroot and putting the wordpress files in a second folder under wwwroot. Otherwise, you are going to have conflicts with the web.config. For example, your directory structure:

  • wwwroot
    • root (asp.net application)
    • blog2 (Worpress files)

Then in the Azure portal >> Application Settings, setup your virtual directory like this: enter image description here

This allows you to independently deploy your asp.net application to root without affecting your Wordpress installation.

Upvotes: 0

Related Questions