ServiceContract & OperationContract выглядит, как показано ниже:Как вернуть тип «Сборка» в WCF?
[ServiceContract]
public interface IAssemblyResolver
{
[OperationContract]
Assembly LoadAssembly(AssemblyLoadRequest loadRequest);
// TODO: Add your service operations here
}
При возвращении типа Assembly
, я получаю ниже ошибки в журнале трассировки:
There was an error while trying to serialize parameter http://tempuri.org/:LoadAssemblyResult . The InnerException message was 'Type 'System.Reflection.RuntimeAssembly' with data contract name 'RuntimeAssembly: http://schemas.datacontract.org/2004/07/System.Reflection ' is not expected. Consider using a DataContractResolver if you are using DataContractSerializer or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to the serializer.'. Please see InnerException for more details.
На стороне клиента я получаю ниже ошибки:
Additional information: An error occurred while receiving the HTTP response to http://localhost:8769/AssemblyResolverService.svc . This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
Вы хотите вернуть двоичный файл dll? – Wojtpl2
Пожалуйста, объясните, что вы пытаетесь сделать. Похоже, что это не сработает. Если вы хотите, чтобы ваша служба WCF размещала DLL для клиентов, вам необходимо передать DLL и ее зависимости клиенту. – CodeCaster
Я хотел загрузить сборку из общего места и просто вернуть ее. – Amit