Hello guys,
I have to delete all of our site portals. But the delete function isn't working propery. It always says an error occured. Can this be done manually?
Thanks.
Hi Brian
This is the error I think. I'm not sure how relevant it is.
Here's the expanded view of the error. I'm sorry, I have now idea what's going on.
Okay, well, to resolve that error we need to introduce a binding redirect. I thought 2Sxc automatically added these, so maybe the first step is to see if there's a newer version of 2Sxc to upgrade to (preferably one of their LTS releases).
If you still continue to see that error, that's where the binding redirects come into play. If you look at your web.config file (either via the file system or through the Config Manager in the Persona Bar) and search for bindingRedirect you will see a section of the file with entries like this:
web.config
bindingRedirect
<dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" /> <bindingRedirect oldVersion="0.0.0.0-32767.32767.32767.32767" newVersion="12.0.0.0" /> </dependentAssembly>
What this is saying is that the assembly (DLL file, compiled code) with the given identity (name is Newtonsoft.Json, signed with the public key 30ad4fe6b2a6aeed) is valid for use when any version is requested (i.e. in the range from version 0.0.0.0 to version 32767.32767.32767.32767) and should use the version 12.0.0.0. This newVersion value needs to match the version of the DLL file in the bin folder.
Newtonsoft.Json
30ad4fe6b2a6aeed
0.0.0.0
32767.32767.32767.32767
12.0.0.0
newVersion
bin
So, in your case, you need to see if there's an existing binding redirect for Microsoft.Extensions.DependencyInjection.Abstractions. If there is, make sure version 1.1.0.0 is included in the oldVersion range. If there isn't, you'll want to add one. The tricky part here is knowing the specific version of the assembly file in the bin to use for the newVersion. There are many different versions associated with the file, so it's not very straightforward to determine what the correct version is. If you use the wrong version, your site won't work at all. You should be able to retrieve the version using Powershell, with the following snippet (using your website's path): [System.Reflection.AssemblyName]::GetAssemblyName('C:\inetpub\wwwroot\mysite.com\bin\Microsoft.Extensions.DependencyInjection.Abstractions.dll').Version.ToString().
Microsoft.Extensions.DependencyInjection.Abstractions
oldVersion
[System.Reflection.AssemblyName]::GetAssemblyName('C:\inetpub\wwwroot\mysite.com\bin\Microsoft.Extensions.DependencyInjection.Abstractions.dll').Version.ToString()
After you've added/updated the binding redirect, you'll want to see if that resolved the issue. It may be that there's another missing binding redirect that you need to add next.
If you get into a scenario where your versions don't match and the site isn't working, I have a Powershell module which has a command to synchronize the binding redirects in the web.config with the files in the bin (though it won't add new binding redirects). To use that, run Install-Module -Name BindingRedirects (see the getting started docs if Install-Module isn't available on your system). Once it's installed, call Sync-BindingRedirect 'C:\inetpub\wwwroot\mysite.com\web.config' to update any incorrect binding redirects.
Install-Module -Name BindingRedirects
Install-Module
Sync-BindingRedirect 'C:\inetpub\wwwroot\mysite.com\web.config'
Hope it helps!
Hi Brian,
Sorry for late reply, and than you for helping us out fix the error. We were able to fix it.
But we still can't delete a portal. Is there a way to do it manually and clean? Thanks.
Ultimately the code you're trying to run is https://github.com/dnnsof...roller.cs#L154-L195. There's a lot going on in there, so any manual deletion is likely to miss a step or two.
This deletes any localized files (e.g. *.Portal-2.resx), the child portal folder(s) (e.g. /my-portal if the URL is mysite.com/my-portal), and the portal folders (e.g. Portals/2 and Portals/2-System).
*.Portal-2.resx
/my-portal
mysite.com/my-portal
Portals/2
Portals/2-System
Then it deletes each user in the portal, which is its own long, involved process, ultimately calling the SQL stored procedure EXEC DeleteUserPortal @userId @portalId; for each user, and finally deletes the portal by running the SQL stored procedure EXEC DeletePortalInfo @portalId;
EXEC DeleteUserPortal @userId @portalId;
EXEC DeletePortalInfo @portalId;
All that said, I would suggest continuing to try to find some details on what's causing the delete request to fail. If you're concerned that the site is still "live" while you're troubleshooting, you can use a temporary site alias URL and remove all of the previous URLs so that no one can find the site anymore.
I would start by looking at the network traffic in your browser tools, and see if the error response to the delete request includes any details. You can also look in the log file if there isn't anything logged to the Admin Logs. You can see the log file via the Servers section of the Persona Bar.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.