Estou tentando hospedar um Web Service em um serviço do Windows. E ao configurar o serviceModel
no App.config
estou recebendo o seguinte aviso de erro do editor:
O WebService está um projeto do tipo Biblioteca de Serviço do WCF
e o projeto que hospedará o WebService é do tipo Windows Service
.
Abaixo segue o código da interface de contrato:
using System.ServiceModel;
namespace FoxMovieStoreWebService
{
[ServiceContract]
public interface IDataPersistance<in T> where T : new ( )
{
[OperationContract]
bool Insert ( T value );
[OperationContract]
bool Change ( T value );
[OperationContract]
bool Delete ( T value );
// TODO: Adicione suas operações de serviço aqui
}
// Use um contrato de dados como ilustrado no exemplo abaixo para adicionar tipos compostos a operações de serviço.
// Você pode adicionar arquivos XSD ao projeto. Depois de criar o projeto, use os tipos de dados definidos nele diretamente, com o namespace "FoxMovieStoreWebService.ContractType".
}
Aqui o App.config
Windows Service onde eu faço a configuração do WebService:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<system.serviceModel>
<services>
<service name="FoxMovieStoreWebService.CrudAddress" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudBooking" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudCashDesk" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudClient" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.Dependent" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudDevolution" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudFunctionary" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudGame" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudMovCashDesk" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudMovie" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="FoxMovieStoreWebService.CrudRent" behaviorConfiguration="ServiceConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9876"/>
<add baseAddress="http://localhost:8766"/>
</baseAddresses>
</host>
<endpoint address="srv" binding="netTcpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="srv" binding="basicHttpBinding" contract="FoxMovieStoreWebService.IDataPersistance"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceConfig">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Tenho quase certeza que esse erro é pelo fato de eu ter criado a interface de contrato como uma Interface Genérica, pois não sei como fica no App.config
nesse caso. Caso minha suspeita se confirme mudarei o título da pergunta.
App.config
mas fiz de forma imperativa, ou seja, realizei as configurações via código C#. Não recebi nenhum erro de compilação.