4 votes

Error when publishing ASP.NET web application in IIS

I get the following error when doing publish to a web page in the iis of my local machine, if I do debug works fine but not when publishing from Visual Studio If I copy the project folder it works without any problem but I can't transfer the files to the server because there is no user or password for ftp I have already been provided with a file to publish it from the Visual Studio


This is the error when opening http://localhost/ControlCobranza

Server error in the application '/ControlCobranza'.

The file or assembly 'Microsoft.AI.Web' or one of its dependencies cannot be loaded. The system cannot find the specified file.

Description: Unhandled exception when executing the current Web request. Review the stack trace for more information about the error and where it originated in the code.

Exception details: System.IO.FileNotFoundException: Cannot load the file or assembly 'Microsoft.AI.Web' or one of its dependencies. The system cannot find the specified file.

Source code error:

An unhandled exception was generated during the execution of the current Web request. current Web request. Information about the source and location of the the exception can be identified using the exception in the following stack trace exception.

Trace when loading the assembly: The following information may be helpful in determining why the 'Microsoft.AI.Web' assembly did not load.

AVS: Registration of the assembly link is disabled. To to enable the assembly link error logging, set the value of the [HKLM] Log value \Software\Microsoft\Fusion EnableLog] (DWORD) as 1. Note: there is a performance degradation associated with the error logging of the assembly link. To disable this feature, remove the value of Log [HKLM \Software\Microsoft\Fusion EnableLog].

Stack tracking:

[FileNotFoundException: Unable to load the file or assembly 'Microsoft.AI.Web' or one of its dependencies. The system cannot find the specified file]. find the specified file]
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +106 System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +62
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +50 System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +61
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +53

[ConfigurationErrorsException: Cannot load file or assembly 'Microsoft.AI.Web' or one of its dependencies. assembly 'Microsoft.AI.Web' or one of its dependencies cannot be loaded. The system cannot find the specified file]. cannot find the specified file].
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +587
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit) +33
System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +57 System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +54 System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +198
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1114 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +140
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Unable to load the file or assembly 'Microsoft.AI.Web' or one of its depots. assembly 'Microsoft.AI.Web' or one of its dependencies cannot be loaded. The system cannot find the specified file]. cannot find the specified file]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +125 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +731

Version information: Version of Microsoft .NET Framework:4.0.30319; Version ASP.NET:4.6.1586.0

0 votes

You say that the local URL works without problems when you hit F5 to run and debug. But the moment you hit publish in your local IIS and go to the URL localhost/ControlCobranza throws the error. You are doing it from WebDeploy (publish) as far as I can see, can you confirm this information my dear?

0 votes

@fredyfx that's right, even if I create a new website in localhost:81 throws the same error

0 votes

You are following all these steps: c-sharpcorner.com/uploadfile/8ef97c/ ?

6voto

rsciriano Points 1952

It is possible that the error occurs because the assembly is not included in the deploy process Microsoft.AI.Web

To have this assembly included in the deploy you have to check the option Copia local=true as shown in the picture

Copia local=true

You also have to do the same with Microsoft.ApplicationInsights and the rest of the assemblies that the application needs and that are not in the GAC

Update:

According to JuankGlezz the problem was in the references and was fixed. updating with the control of Nuget packages .

Once this problem was fixed, this other error also occurred when publishing using Webdeploy :

Web deployment task failed (This access control list is not in canonical format and therefore cannot be modified).

This error had to do with a permissions configuration problem in IIS and is corrected by following the steps described in this answer of S.O. in English

  1. Go to IIS
  2. Right-click on the published web site and select Edit permissions
  3. Click on the Security
  4. Click on Edit and a message will appear saying that the permissions are not sorted correctly
  5. Click on the button Reorder of the message window

Reordenar permisos

0 votes

I have them as you mentioned and I still get the same error.

0 votes

@JuankGlezz if you are not going to monitor the application you could remove the setting you mention. Another thing you could do is enable the fusion Log to get more information on why it is not finding the assembly. You could also check locally the assemblies that it is copying in the release....

0 votes

I tried to do the fusion Log and it didn't work, what I did was to update the references with the Nuget package control and the problem was solved, but it doesn't allow me to publish by WebDeploy only with File System, when I do it with webdeploy it marks this error Web deployment task failed. (Esta lista de control de acceso no está en formato canónico y, por lo tanto, no se puede modificar.)

1voto

yessermiranda97 Points 21

I had the same error, but it happened to me because I had disabled IIS services, look for the option of Enable or disable Windows features and search for Internet Information Services, activate the features you needed.

introducir la descripción de la imagen aquí

I hope this helps, although at the beginning, perform all the steps shown above, but do not discard this option, where you may have disabled the Internet Information Services.

-1voto

I had the same problem and I solved it as indicated in this response on Stack Overflow in English :

  1. Create a new application pool
  2. Go to the Advanced Settings of this application pool
  3. Set the Enable 32-Bit Application to True
  4. Point your web application to use this new pool

0 votes

Thank you for your contribution, Bernabé and welcome to Stack Overflow . read how to create a good question to learn more about the site. You can also see what functions does the site have so that you can organize the code or whatever you put in your question . Greetings.

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X