Moving to new server = error - iis

I have a pretty standard Sitecore site (no extra assemblies etc., just some layouts and xslt files). The site is working fine on my own server (old w2003 w/iis6). The site now needs to be moved to a new server (w2008 w/iis7). But the site fails to lad, giving this error;
Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
In the following line in the web.config
Line 3176: <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Any ideas as to what could be wrong? I dont have access to the server myself, but have just been sent a link to the site, where i can see the above error.

It seems that you have MVC dependencies you also have to deploy to a new server. This thread might be helpful.

Related

IIS V10.0 in Windows 10 does not recognise anymore customErrors on web.config with 500.19 0x80070032 error

I use IIS 10 on windows 10, I was use to have web.config files with customErrors, but now it is not accepting it anymore. I been procrastinating hotfixing just removing the line from the webconfig, but now I am trying to figure out what is wrong and fix it once and for all.
Error Source:
<system.web>
<customErrors mode="Off"/>
<httpRuntime targetFramework="4.6.2" />
The machine config has <deployment retail="true" />, and whit this configuration if I remove the tag IIS works fine and the web application is served correctly, if I change the retail setting to false, it will break again asking for the customErrors to be set.
I could not find any information online on this specific type of issue, and I tried to follow also the error code investigation path, but it leads to TLS configuration which in my case is correct and enabled.
After lots of digging I found that one of the machine.config (for the current framework4x and architecture x64) had a missing section in the system.web group:
<sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<section name="customErrors" type="System.Web.Configuration.CustomErrorsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
I copied the section from the 32 bit version of the machine.config and this fixed the issue.
This documentation about IIS configuration hierarchy helped me:
https://learn.microsoft.com/en-us/iis/get-started/planning-your-iis-architecture/the-configuration-system-in-iis-7#:~:text=%20At%20the%20root%20%28or%20global%29%20level%2C%20there,global%20defaults%20for%20the%20.NET%20framework...%20More%20

CodeDom Provider could not be located on IIS7

I have added a site on my IIS but when I try to get to the default page, I get the following error :
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.
Source Error:
Line 12: <system.codedom>
Line 13: <compilers>
Line 14: <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
Line 15: <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
Line 16: </compilers>
Do I need to install the "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" package with nuget to make it works or is it something different ?
You can comment out the entire System.CodeDom section from web.config.
WebApplication projects will have the CodeDom section, WebSite projects wont. Comment it out and it should start working.
Source:
http://www.codeproject.com/Questions/1034471/Unable-to-run-ASP-net-pages-on-web-server
Try running inetmgr (IIS) right click your website and Choose Convert to Application.
This worked for me.
Maybe do you have different version compiler? Try - Project > Manage NuGet Packages... > Browse(tab) > in search input set this:
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
You can install or update or uninstall and install this compiler
I solved similar issue by installing updates TOOLS->NuGetPackage Installer MENU -> ALL-> Update especially for Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Similar answer to Bayak, you have settings in WebConfig that are not compatible for your web server. Visual Studio can add alot of extra weight to the file by default. Trim WebConfig to:
<configuration>
<system.web>
<customErrors mode="Off"></customErrors>
<compilation debug="true" targetFramework="4.6.1"/>
<httpRuntime targetFramework="4.6.1"/>
</system.web>
</configuration>

Web service giving "could not load file or assembly error"

I just moved a website and related web service from IIS6 to 8.
The website works fine, but the webservice is giving the following error:
Server Error in '/CreditCardService' Application.
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
The web service config file do not have any related lines in it.
Only the website web.config has any related lines in it, see below.
<add assembly="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Any ideas how to resolve this?

Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=2.0.0.0

I recently updated a website from VS2008 to VS2010. Publish with Web Deploy tool but I get the following error
Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Reference.svcmap: Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Source Error: [No relevant source lines] Source File: /App_WebReferences/websConsultarCOVE/ Line: 1 Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be loaded. WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18010
The error is in reference to a third party webservices
OS: Windows Server 2012
Thank you very much in advance

Azure Diagnostics is looking for StorageClient 1.7.0.0, but I'm using StorageClient 1.7.1.0

I'm using the Microsoft.WindowsAzure.StorageClient version 1.7.1.0 available at: https://github.com/WindowsAzure/azure-sdk-for-net/tree/sdk_1.7.1. My project compiles just fine, but when I run it I get the following error:
Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
with an inner exception of:
Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
I looks like there is a dependency in Microsoft.WindowsAzure.Diagnostics on version 1.7.0.0 of Microsoft.WindowsAzure.StorageClient. However I am using version 1.7.1.0, and as far as I know I can't have both 1.7.0 and 1.7.1 in the same project. Any ideas how to make Microsoft.WindowsAzure.Diagnostics dependent on 1.7.1 if this is indeed the problem?
Thanks, Kurt
Update
As per recommendation below I added s startup task to load the version 1.7.0 using gacutil (this was useful http://blogs.infosupport.com/adding-assemblies-to-the-gac-in-windows-azure/). I have 2 WorkerRoles and 2 WebRoles. The problem I have now is that when I compile and run, VS2012 copies the 1.7.0 into the WebRoles' respective ...\csx\Debug\roles[WebRoleName]\approot folder, despite there being no direct reference to version 1.7.0 in the project. The following compile output shows the error this introduces when Azure attempts to load verison 1.7.1 (which it now can't find):
System.TypeLoadException: Unable to load the role entry point due to the following exceptions:
-- System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null'
=== Pre-bind state information ===
LOG: User = BERTIES_MAIN\kurt_000
LOG: DisplayName = Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///H:/Everything/Current_Work/Web_Apps/Azure/InSysCloud/InSysCloud/InSysCloud/csx/Debug/roles/InSysWatcher/approot
LOG: Initial PrivatePath = H:\Everything\Current_Work\Web_Apps\Azure\InSysCloud\InSysCloud\InSysCloud\csx\Debug\roles\InSysWatcher\approot
Calling assembly : InSysWatcher, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: H:\Everything\Current_Work\Web_Apps\Azure\InSysCloud\InSysCloud\InSysCloud\csx\Debug\roles\InSysWatcher\approot\InSysWatcher.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///H:/Everything/Current_Work/Web_Apps/Azure/InSysCloud/InSysCloud/InSysCloud/csx/Debug/roles/InSysWatcher/approot/Microsoft.WindowsAzure.StorageClient.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Why would VS2012 be adding the DLL for version 1.7.0, when 1.7.1 is referenced in the project itself, and version 1.7.0 is only included as content, and loaded into the GAC at app startup?
Well, in such cases you would use a binding redirect in the web.config/app.config. But the problem is the PublicKeyToken. The 'official' assembly 1.7.0.0 has the following PublicKeyToken: 31bf3856ad364e35.
Now, since you're building the 1.7.1.0 version yourself you'll end up with a different PublicKeyToken and in that case the binding redirect does not work.
But the GAC was built for this, to support multiple versions of an assembly. What I would suggest is the following:
Include the 1.7.0.0 assembly in your package, but add it as content (not as reference).
Create a startup task that deploys the assembly to the GAC (using gacutil), since the task will run before starting your role.
Keep using 1.7.1.0 with a normal assembly reference.
Your app should use 1.7.1.0 for your code, and the diagnostics assembly should be able to use version 1.7.0.0 from the GAC
I didn't have a chance to test this yet so I'm looking forword to your feedback.
It appears I can add the following reference into my web.config to work-around this problem:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.StorageClient"
publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="1.1.0.0"
newVersion="1.7.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.StorageClient"
publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<publisherPolicy apply="no" />
</dependentAssembly>
</assemblyBinding>
</runtime>
This essentially allows the references to v1.1 of the dll to be re-mapped to 1.7.

Resources