1
Vote

TCP/IPC RemotingException on serviceLocator.GetInstance<>

description

Hello all. I'm trying to build a SharePoint Sandbox solution working with the Service Locator.
 
The solution has just a simple coded WebPart with a label, taking a string from a service. The service is provided by ServiceLocator:
--- IMessageProvider messageProvider = serviceLocator.GetInstance<IMessageProvider>();
--- label.Text = "This is the message: " + messageProvider.Message;
 
The mapping is registered during feature activation, as suggested in MSDN docs for Sandbox solutions:
--- typeMappings.Site = properties.UserCodeSite;
--- typeMappings.RegisterTypeMapping<IMessageProvider, MessageProvider>();
 
I tried by commenting out various bits and by debugging: the exception occurs as soon in web part code I call serviceLocator.GetInstance.
 
The inner exception (included in zip too) starts with:
System.Runtime.Remoting.RemotingException: Failed to write to an IPC Port: The pipe is being closed.
 
Previously I tried to work with an already existing - more complex - web part, and I was having an exception already during feature activation. In that case it was:
System.Runtime.Remoting.RemotingException: Tcp channel protocol violation: expecting preamble.
 
My dev box runs SharePoint Foundation 2010 over Windows 7 64bit.
 
Anyone has any suggestion?
 
Edit:
Of course all of this does not happen if I try with a Farm solution (and in feature activation I register mapping at site level with properties.Feature.Parent, instead of properties.UserCodeSite)

file attachments

comments