Error in dynamic language environment combined with IIS 7.5

I apologize for this length of the question, but I think you will find it all necessary. Before you begin, let me say that I really tried to create an isolated console application, but unfortunately this turned out to be impossible. Error in console application. This does not happen in a stand-alone ASP.NET application. This only happens when running in IIS 7.5 on Windows 7.

The error is related to the dynamic language version, because it includes a combination of __TransparentProxy (via WCF) and a variable dynamic (int). The line that creates the problem is a call to a static method (which does not contain the body of the method), passing in both the proxy and the dynamic int.

As soon as the method is called, the w3wp.exe process processes the entire processor and begins to quickly increase memory (for me, about 100 megabits per second, although it is compressed presumably due to GC'ing).

To reproduce this error, create a new ASP.NET website in Visual Studio ("New" | "Project" "C #" | "Web" | "ASP.NET Web Application"). Then create a new site in IIS, the home directory of which is your new project. (also give โ€œEveryoneโ€ full read / write access to this folder and make sure that the application pool uses .NET 4.0). Give the new site a specific port, for example 7080. Finally, paste this code into the Global.asax.cs file:

 public class Global : System.Web.HttpApplication { void Application_Start(object sender, EventArgs e) { dynamic dynamicId = 5; var serviceUrl = "http://localhost:7182/FooServices.svc"; ChannelFactory factory = new ChannelFactory<IFooServices>(new WSHttpBinding(), new EndpointAddress(serviceUrl)); factory.Open(); IFooServices fooServices = ((ChannelFactory<IFooServices>)factory).CreateChannel(); BlowUpTheProgram(fooServices, dynamicId); // This line hangs } [ServiceContract] public interface IFooServices { [OperationContract] void Bar(); } public static void BlowUpTheProgram(IFooServices eventServices, int authorMailboxId) { } } 

Now go to the site in your browser via http://localhost:7080 (or any other port that you selected). You have a task manager because you want to kill the w3wp.exe process after confirming the reported symptoms.

To confirm that the proxy and speaker are working together to send this error, change this line:

 dynamic dynamicId = 5; 

To:

 int dynamicId = 5; 

Try again and you will notice that the problem has disappeared and the page has loaded. Now change it to dynamic , and then change this line:

 IFooServices fooServices = ((ChannelFactory<IFooServices>)factory).CreateChannel(); 

To:

 IFooServices fooServices = null; 

Try again and you will notice again that there is no problem in this scenario either.

Finally, if I attach the debugger and break everything, I can see what it is doing, stuck in this method call. It always seems to show something like:

mscorlib.dll! System.RuntimeMethodHandle.GetDeclaringType (method System.IRuntimeMethodInfo) + 0x2f bytes
mscorlib.dll! System.Reflection.Emit.DynamicResolver.ParentToken (int token) + 0x1f3 bytes
Transition to a managed transition

[Run for root transition]
mscorlib.dll! System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType, object target) + 0x29 bytes
System.Core.dll! System.Linq.Expressions.Expression> .Compile () + 0xbb bytes
System.Core.dll! System.Runtime.CompilerServices.CallSiteBinder.BindCore> (System.Runtime.CompilerServices.CallSite> site, object [] args) + 0x10a bytes
System.Core.dll! System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3 (System.Runtime.CompilerServices.CallSite site = {System.Runtime.CompilerServices.CallSite>}, WebApplication1.Global arg0 = {ASP.global_asax}, WebApplication1.GlobalRimeSoo .Remoting.Proxies .__ TransparentProxy}, object arg2 = 5) + 0x3f0 bytes
WebApplication1.dll! WebApplication1.Global.Application_Start (object sender = {System.Web.HttpApplicationFactory}, System.EventArgs e = {System.EventArgs}) String 19 + 0x1b8 bytes C #

For recording, I tried it on three different machines and could only play it on Windows7 / IIS7.5 windows. There were no problems in the Windows Server 2008 / IIS7 window.

The question is how to solve this problem and call the method successfully? Also, why is this happening? I would really like to be too careful when invoking what will use the DLR, because this will cause the IIS to fail.

+4
c # dynamic dynamic-language-runtime transparentproxy
source share
1 answer

I cant answer. Why this happens, however, when passing your dynamic object to int , passing the parameter will work.

 DontBlowUpTheProgram(fooServices, (int)dynamicId); 

Perhaps someone with more knowledge of the insides will go deeper with a more complete explanation.

+6
source share

All Articles