When trying to use Spring ServiceHostFactory to wire up my WCF service according to instructions in section 48.2.2 here: http://www.springframework.net/doc-l...uickstart.html, I get the following exception:
[ArgumentNullException: Value cannot be null.
Parameter name: con]
System.Reflection.Emit.CustomAttributeBuilder.Init CustomAttributeBuilder(ConstructorInfo con, Object[] constructorArgs, PropertyInfo[] namedProperties, Object[] propertyValues, FieldInfo[] namedFields, Object[] fieldValues) +9461821
Spring.Util.ReflectionUtils.CreateCustomAttribute( CustomAttributeData attributeData) +1097
Spring.Proxy.AbstractProxyTypeBuilder.ApplyMethodA ttributes(MethodBuilder methodBuilder, MethodInfo targetMethod) +200
Spring.Proxy.AbstractProxyTypeBuilder.ImplementInt erface(TypeBuilder typeBuilder, IProxyMethodBuilder proxyMethodBuilder, Type intf, Type targetType, Boolean proxyVirtualMethods) +281
Spring.Proxy.AbstractProxyTypeBuilder.ImplementInt erface(TypeBuilder typeBuilder, IProxyMethodBuilder proxyMethodBuilder, Type intf, Type targetType) +21
Spring.Proxy.CompositionProxyTypeBuilder.BuildProx yType() +168
Spring.ServiceModel.Support.ServiceProxyTypeBuilde r.BuildProxyType(IObjectFactory objectFactory) in l:\projects\spring-net\trunk\src\Spring\Spring.Services\ServiceModel\ Support\ServiceProxyTypeBuilder.cs:116
Spring.ServiceModel.SpringServiceHost.CreateServic eType(String serviceName, IObjectFactory objectFactory, Boolean useServiceProxyTypeCache) in l:\projects\spring-net\trunk\src\Spring\Spring.Services\ServiceModel\ SpringServiceHost.cs:111
Spring.ServiceModel.Activation.ServiceHostFactory. CreateServiceHost(String reference, Uri[] baseAddresses) in l:\projects\spring-net\trunk\src\Spring\Spring.Services\ServiceModel\ Activation\ServiceHostFactory.cs:69
System.ServiceModel.HostingManager.CreateService(S tring normalizedVirtualPath) +1440
System.ServiceModel.HostingManager.ActivateService (String normalizedVirtualPath) +44
System.ServiceModel.HostingManager.EnsureServiceAv ailable(String normalizedVirtualPath) +615
It looks the problem is related to the proxy object being built by ServiceProxyTypeBuilder.
The problem can be reproduced using the following code/test:
This appears to be a bug in Spring?!?Code:[ServiceContract] public interface IService { [OperationContract(Name = "namespace/service")] [WebInvoke(Method = "GET", UriTemplate = "namespace/service/{yearfilter}/{monthfilter}")] Stream GetStuff(string yearfilter, string monthfilter); } [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Service : IService { [PrincipalPermission(SecurityAction.Demand, Role = "somerole")] public Stream GetStuff(string yearfilter, string monthfilter) { return new MemoryStream(new byte[] { }); } } public class ServiceHostFactoryTests { [Test] public void TestIt() { var typeBuilder = new CompositionProxyTypeBuilder {TargetType = typeof (Service)}; Type proxyType = typeBuilder.BuildProxyType(); Assert.IsNotNull(proxyType); } }
I am using version 1.3.0, targeting .NET 4.0.


Reply With Quote