I'm trying to add a MessageContract to my WCF service, similar to what's going on in this question: WCF: using streaming with Message Contracts
Here's the exception I get: The operation 'UploadFile' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.
Here are my contracts:
[ServiceContract]
public interface IFile
{
[OperationContract]
bool UploadFile(FileUpload upload);
}
[MessageContract]
public class FileUpload
{
[MessageHeader(MustUnderstand = true)]
public int Username { get; set; }
[MessageHeader(MustUnderstand = true)]
public string Filename { get; set; }
[MessageBodyMember(Order = 1)]
public Stream ByteStream { get; set; }
}
And here's the binding configuration I'm using in my app.config:
<netTcpBinding>
<binding name="TCPConfiguration" maxReceivedMessageSize="67108864" transferMode="Streamed">
<security mode="None" />
</binding>
</netTcpBinding>
Right now I'm thinking that this may have something to do with the type of binding I'm using, but I'm not entirely sure.
Debugger.Launch();
in your windows service host project before you create the service host instance, then you can debug the startup problem of your instance and be able to see what the exception is. Some more details of the config file would also be useful. – Woodpile