DLL Compilation Error (ASP.NET) - asp.net

We have a webserver with two versions of the AjaxControlKit on it. Im getting the following error when hitting certain pages on a specific web application.
The type
'AjaxControlToolkit.CalendarExtender'
exists in both
'c:\Windows\assembly\GAC_MSIL\AjaxControlToolkit\3.0.30930.28736__28f01b0e84b6d53e\AjaxControlToolkit.dll'
and
'c:\Windows\assembly\GAC_MSIL\AjaxControlToolkit\3.0.30512.20315__28f01b0e84b6d53e\AjaxControlToolkit.dll'
The web project Im running has a reference to the x.30930 dll, and it also has
<add assembly="AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
Specified in the web.config.
For the life of me I cant find out why it wants to try running x.30512.
Any suggestions?

Aaargh there was a reference to it in the 'global' web.config (in the c:\windows\microsoft.net\ folder

Related

When calling Web API in ASP.NET Web form, it could not load file or assembly 'Autofac.Integration.Web' or one of its dependencies

Maybe this question is too broad but it has wasted a lot of time and I can't find out a solution for that. So I decided to share my problem for any idea.
I have a ASP.NET Web Form project that has a web page (.aspx) including one tag like this:
<iframe runat="server" src="API URL"></iframe>
By running the project I get following error:
Could not load file or assembly 'Autofac.Integration.Web' or one of
its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load
file or assembly 'Autofac.Integration.Web' or one of its dependencies.
The system cannot find the file specified.
If I remove this tag, I don't have any error.
In fact, a couple of days before I added Autofac and it added following tags to my web config:
<modules runAllManagedModulesForAllRequests="true">
<add name="ContainerDisposal" type="Autofac.Integration.Web.ContainerDisposalModule, Autofac.Integration.Web" preCondition="managedHandler"/>
<add name="PropertyInjection" type="Autofac.Integration.Web.Forms.PropertyInjectionModule, Autofac.Integration.Web" preCondition="managedHandler"/>
</modules>
When I am removing these add tags, I have no error. I don't know why these tags have negative impact on calling the API.
Another point, which it probably could be important, is API includes Hangfire. But as far as I know, there isn't any reference from Autofac in API.
Edit
The Web API is located in sub folder of Web form application in a operational server like this:
Web Form Application:
> bin
> web.config
> Web API
> bin
> web.config
As you can see, Web form application web.config affects on Web API because of location of the Web API. Due to some reasons, I can't change the locations.
I have seen many topics and articles about it, but they didn't give me a clue.
Any idea?
Thanks in advance.

Adding Web API to existing application with virtual directory

I have an existing website setup and working (kentico 10), I want to add Web API to it using a virtual directory.
I setup the web api project and it works when I map IIS to it as a normal site. However when I map the folder as a virtual directory and convert to application into my kentico site I get errors. What I dont understand is why I am getting errors originating from the kentico web config and not the new web api web.config/service:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Web' does not exist in the namespace 'CMS.Base' (are you missing an assembly reference?)
Source Error:
Line 47: <namespaces>
Line 48: <add namespace="CMS.Helpers" />
Line 49: <add namespace="CMS.Base.Web.UI" />
Line 50: </namespaces>
Line 51: </pages>
I did try adding these DLLs into the bin of the web api project which stopped this error but I couldnt retrieve data as expected from kentico in the web-api project.
Thanks
Whenever you create an application within a website in IIS, the parent web.config will be inherited by the sub applications very similar to how a main website inherits the "global" web.config. Maybe not all of the nodes will be inherited but a lot of them will be.
So what you'll want to do is add (i.e.: <remove name="WebDAVModule" />) nodes to areas in which you want to remove namespaces or such in your newly created sub application's web.config. I cannot say specifically which nodes will need to have those nodes applied but trial and error should help. If you follow the errors that come on-screen, they should help with adding those nodes in your child web.config.

Getting error:-CS0433 IN ASP.NET

I am getting error when i am publish my ASP.NET Application in localhost using IIS 7.5.
all the pages run perfectly expect on and getting error:-
Compiler Error Message: CS0433: The type 'pages_Default' exists in
both'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\785050d7\543e65af\assembly\dl3\6a3d3e87\242bc946_6834cf01\App_Web_zxwcuztt.DLL'
and 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\785050d7\543e65af\assembly\dl3\c72e1cad\7d5dd447_6834cf01\App_Web_b5bhtyqt.DLL
Plese Help me to resolve this
Try it:
I set the batch="false" attribute on the compilation section in web.config worked for me.
This tells ASP.NET to dynamically compile individual .aspx/.ascx files into separate assemblies. This avoids the circular reference issue that triggers the exception.
<configuration>
<system.web>
<compilation debug="false" batch="false"></compilation>
</system.web>
</configuration>
Or
You will have a path similar to the following:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
Delete the contents of this entire folder (no harm will be done), then try and Clean and Rebuild your solution.
Or
The problem occurred in a virtual application's bin folder. Looking into this bin-folder you will probably see two files (an information i found here):
App_global.asax.dll
App_global.asax.compiled
Removing these resolves the error. The App_global.asax.dll is generated at runtime too which causes the problem.
I am however still investigating how these files got there, so comments are definitely welcome!

MonoDevelop: Failed to load http handler

I am running MonoDevelop on OS X to develop an ASP.NET web application using Nancy. I downloaded the nancy.dll file and referenced it from my web project.
Inside the web.config I added the line:
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</httpHandlers>
to the system.web section, as described in the documentation of Nancy. However, if I try to run my application, my browser comes up and I see an ASP.NET error message created by Mono that tells me that it
Failed to load httpHandler type `Nancy.Hosting.Aspnet.NancyHttpRequestHandler'
Any idea of what I am doing wrong? Why is Mono not able to find the DLL, although it is there?
I got it ... I had missed to also download and install the Nancy.Hosting.Aspnet package.
Once I did this and referenced the dll, everything works fine :-)

Troubleshooting Silverlight 5 and Ria services [Web-Services-AuthenticationService.svc does not exist]

I have two different versions of a Silverlight 5 project using Ria services. Both work locally. The older version (A) works when deployed to ISS7. The new version (B) does not. There is user/password authentication that fails for version B with the error:
Load operation failed for query 'Login'. the remote server returned an error: NotFound.
Referencing various SO and MSDN posts over the past week, I have tried many troubleshooting techniques. Adding error logging as suggested here to the web.config results in the following being logged:
The service '/ClientBin/MyApp-Web-Services-AuthenticationService.svc' does not exist.
Researching that led to finding this forum post which suggests creating a dummy .svc file with the name/path it is looking for. The result:
The service '/ClientBin/DBCRM-Web-Services-AuthenticationService.svc' cannot be activated due to an exception during compilation. The exception message is: The ending bracket '>' for the 'ServiceHost' directive is missing in the '.svc' file..
The details of the above error aren't largely important as it was a blank .svc file I supplied. It merely served to confirm that fact that the project was indeed dependent on it
Here's the kicker... the working version DOES NOT contain this file either, yet it does not throw an exception.
Searching for any reference to needing the service surprisingly turned up a result in both solutions. Both MyApp.Web.g.csfiles are identical (ran a CSDiff) and both contain the line:
public AuthenticationContext() :
this(new WebDomainClient<IAuthenticationServiceContract>(new Uri("DBCRM-Web-Services-AuthenticationService.svc", UriKind.Relative)))
{
}
Both have the same package/deploy settings. I am deploying to a file system, then copying the files over to IIS on my host server.
Questions:
Where is a setting that makes this .svc file a requirement? It's clearly not needed in version A, but is in version B. Again, file MyApp.Web.g.csis the only reference to it, and it exists in both versions.
MyApp.Web.g.cs is a generated file. What service in Visual Studio 2010 creates this file? Also, can I modify it to not include the call to the .svc file in question?
I'm going to start merging the two solutions together to see at which point the .svc file becomes neccessary. Any ideas in the meantime would be greatly appreciated!
WCF Ria Services registers an HttpModule in order to manage the wcf ria services calls. When the request arrive to the server that module read the url and understand which service to instantiate and which method to call. So it's absolutely normal that you don't find any .svc file
Don't mess with the .g.cs your problem isn't here.
Take a look at your web.config file, you should find rows like this
<system.web>
<httpModules>
<add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
...
</system.web>
and this
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
...
</system.webServer>
Besides making sure that the "DomainServiceModule" entries are present in Web.Config as stated above, another thing is that RIA requires ASP .NET compatibility mode to be enabled. Here is a link to Microsoft's deployment guide for RIA:
http://msdn.microsoft.com/en-us/library/ff426912(v=vs.91).aspx
In the third paragraph of the "Configure the Web Server" section, it states that you need the following in your Web.Config file:
<system.serviceModel>
...
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
...
</system.serviceModel>
When this is missing, you get the behavior described in your question.
Before you do any of this make sure the regular bin folder is actually deployed containing your actual code.
I was deploying with MSDEPLOY to a new server and it did not deploy bin folder. You're not going to get anywhere without that!

Resources