Windows service hosting a WCF service closing immediately - wcf

I tried hosting a WCF Library service with windows service project, I installed the service, however, when i start the service in services.msc, the service start and closses immediatly. Following the message that gets displayed:
The Servicel service on Local
Computer started and then stopped.
Some services stop automatically if
they are not in use by other services
or programs.
The App.config file for wcf and the windows service project is same and it is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WorkMateWCF.Service1">
<endpoint address="" binding="netTcpBinding" bindingConfiguration=""
contract="WorkMateWCF.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8523/WorkMate1" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
The entire project/solution is downloadable here: https://skydrive.live.com/?cid=d358d316fa2c3a37&sc=documents&uc=1&id=D358D316FA2C3A37%21135#
Could you please guide me on how to proceed further. Thank you.
Additional information:
Following is the code from the service1.cs file in windows service project.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.ServiceModel;
using WorkMateWCF;
namespace WorkMateWinService
{
public partial class Service1 : ServiceBase
{
internal static ServiceHost MyServiceHost = null;
public Service1()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
if (MyServiceHost != null)
{
MyServiceHost.Close();
}
MyServiceHost=new ServiceHost(typeof( Service1));
MyServiceHost.Open();
}
protected override void OnStop()
{
if (MyServiceHost != null)
{
MyServiceHost.Close();
MyServiceHost = null;
}
}
}
}

What I find very confusing (and probably the .NET runtime, too) is the fact that your Windows Service is called Service1, while your WCF Service also is called Service1 (without a namespace or anything).
So which of the two Service1 class types will be used here???
MyServiceHost = new ServiceHost(typeof(Service1));
I'm not sure - and I'm afraid it will be the wrong class (the Windows NT Service class).
You should give your stuff more meaningful names and keep those things apart (by name, too) !

Got the issue, when I reviewed my event logs I found this:
"Service cannot be started. System.InvalidOperationException: The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address. Either supply an http base address or set HttpGetUrl to an absolute address.
at System.ServiceModel.Description.ServiceMetadataBehavior.EnsureGetDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, String scheme)
at System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex)
at System.ServiceModel.Description.ServiceMetadataBehavior.ApplyBehavior(ServiceDescription description, ServiceHostBase host)
at System.ServiceModel.Description.ServiceMetadataBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescript..."
Then after thorough reviewing, the issues is that I did HTTPSGETENABLED to false only for one, infact there are two, after making the change for the other one, the app started to work like charm.
I special

Related

WCF hosted in Windows service via TCP - can't consume

I just spend 4 hours googling around trying to find why i cant consume (add service reference) WCF hosted in Windows service. Error i am getting is this
The URI prefix is not recognized.
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8523/Service1'.
Could not connect to net.tcp://localhost:8523/Service1. The connection attempt lasted for a time span of 00:00:02.0158574. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8523.
No connection could be made because the target machine actively refused it 127.0.0.1:8523
If the service is defined in the current solution, try building the solution and adding the service reference again.
I created a small service following this tutorial https://msdn.microsoft.com/en-us/library/ff649818.aspx to the letter. I'm stuck on step 8 where i get error i posted above.
My App.config (WCF configuration)
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<bindings />
<services>
<service name="WcfServiceLibrary1.Service1">
<endpoint address="" binding="netTcpBinding" bindingConfiguration=""
name="netTcpEndpoint" contract="WcfServiceLibrary1.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="" binding="mexTcpBinding" bindingConfiguration=""
name="mexTCPendpoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8523/Service1" />
</baseAddresses>
<timeouts closeTimeout="00:01:00" openTimeout="00:02:00" />
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="false"
includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Service.1.cs
public partial class Service1 : ServiceBase
{
internal static ServiceHost MyServiceHost = null;
public Service1()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
if (MyServiceHost != null)
{
MyServiceHost.Close();
}
MyServiceHost = new ServiceHost(typeof(Service1));
MyServiceHost.Open();
}
protected override void OnStop()
{
if (MyServiceHost != null)
{
MyServiceHost.Close();
MyServiceHost = null;
}
}
}
Things I've tried so far:
Turning off windows firewall
Opening port TCP 8523 (in and outbound rules)
Changing port numbers
Checking netstat -atn (TCP port 8523 is not listnening)
Double checking that serviceProcessInstaller1 has account option set to Network service
Double checking that serviceInstaller1 has StartType option set to Automatic
Double checking that Service1 is Started in services.msc
Enabled all Net.XXX Services in services.msc
Remove then Added TCP Activation and TCP Port Sharing in "Turn windows features on or off"
Ran out of ideas
Any help as to why i can't consume WCF is highly appreciated.

How to debug CustomServiceHostFactory in WCF?

I've recently implemented a CustomServiceHostFactory and am wondering how to debug it by hitting breakpoints in code. Here is the factory:
public class CustomHostFactory : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
ServiceHost host = new ServiceHost(serviceType, baseAddresses);
//configure WsHttpBinding
ConfigureServiceThrottling(host);
return host;
}
private void ConfigureWshttpBinding(ServiceHost host)
{
//Do something here....
}
private void ConfigureServiceThrottling(ServiceHost host)
{
ServiceThrottlingBehavior throttle = host.Description.Behaviors.Find<ServiceThrottlingBehavior>();
if (throttle == null)
{
throttle = new ServiceThrottlingBehavior
{
MaxConcurrentCalls = 100,
MaxConcurrentSessions = 100,
MaxConcurrentInstances = 100
};
host.Description.Behaviors.Add(throttle);
}
}
}
I create this in an empty web project and here are the pertinent Web.config contents.
<service name="Company.Project.Business.Services.AccountService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address=""
binding="basicHttpBinding"
contract="Company.Project.Business.Contracts.Service.IAccountService"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
<service name="Company.Project.Business.Services.AccountClassService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address=""
binding="basicHttpBinding"
contract="Company.Project.Business.Contracts.Service.IAccountClassService"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<serviceHostingEnvironment>
<!-- where virtual .svc files are defined -->
<serviceActivations>
<add service="Company.Project.Business.Services.AccountService"
relativeAddress="AccountService.svc"
factory="Company.Project.WebHost.CustomHostFactory"/>
<add service="Company.Project.Business.Services.AccountClassService"
relativeAddress="AccountClassService.svc"
factory="Company.Project.WebHost.CustomHostFactory"/>
</serviceActivations>
</serviceHostingEnvironment>
I publish this to IIS and can successfully browse to and consume the services. Here is a path to one for example.
http://company.server.local/Project/Account/AccountService.svc
I am now trying to programmatically apply WsHttpBinding with open/close/send timeouts, readerQuotas, etc. I am trying to do this all in code and it would be helpful if I could step into the CustomeHostFactory to debug but have no idea how to do that. Any help is much appreciated. Thanks.
Ok, I was totally confused here. Instead of trying to attach to the w3wp process, I just set the project with the CustomHostFactory as the startup project in Visual Studio. I put a breakpoint in the protected override ServiceHost CreateServiceHost method.
Then, when I run the project http://localhost:58326/ comes up in a browser. I then had to actually browse to an endpoint like so: http://localhost:58326/Account/AccountService.svc in order to hit the breakpoint.
Now I can debug my programmatic configuration of the service. Hopefully this helps someone else.

Not getting the expected results from WCF REST Service (Newbie)

I'm new to WCF Web Services. I'm trying to test my simple hello world web service.
For now, I'm doing self hosting. I'm at the point where I've started the host application, opened my browser and typed in the address to my resource. I've also run Fiddler and created a Request by using the Composer. In both cases, I get the "You have created a service." page that has a link to my .wsdl.
I was expecting to see the "Hello World" text in my Response or a web page that has "...Hello world".
What am I missing? or am I just misunderstanding the process?
App.Config
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="My.Core.Services.GreetingService" behaviorConfiguration="MyServiceTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/greeting"/>
</baseAddresses>
</host>
<endpoint name="GreetingService" binding="webHttpBinding" contract="My.Core.Services.IGreetingService"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Host code
using System;
using System.ServiceModel;
using My.Core.Services;
namespace My.Service.Host
{
class Program
{
static void Main(string[] args)
{
using (var host = new ServiceHost(typeof(GreetingService)))
{
host.Open();
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.WriteLine();
Console.ReadLine();
host.Close();
}
}
}
}
Hello World Contract and Service
using System.ServiceModel;
using System.ServiceModel.Web;
namespace My.Core.Services
{
[ServiceContract]
public interface IGreetingService
{
[OperationContract]
[WebGet(UriTemplate = "/")]
string GetGreeting();
}
}
using System.Collections.Generic;
namespace My.Core.Services
{
public class GreetingService : IGreetingService
{
public string GetGreeting()
{
return "Greeting...Hello World";
}
}
}
If I understand you correctly, you can see your wsdl link at the following url
http://localhost:8080/greeting
In order to now call your endpoint, you need to add it to the url like this
http://localhost:8080/greeting/GetGreeting/
I'm not entirely sure why you have the UriTemplate thing in there though other than my guessing that you probably just copy pasted it from an example. Unless you have specific query string parameters that you want defined, you don't really need it and it kind of tends to complicate things so I'd recommend taking it out. That means your Interface would look something like this...
[ServiceContract]
public interface IGreetingService
{
[OperationContract]
[WebGet]
string GetGreeting();
}
...and you can then lose the final "/" on the url.
I figure out the problem. When I use the url: "http://localhost:8080/greeting" the server sends the temp page. When I add the backslash "/" on the end of the url it execute my service.
so, "http://localhost:8080/greeting/" works and sends me the "...Hello World" back.

WCF Metadata contains a reference that cannot be resolved

I've spent a couple of hours searching about this error, and I have tested almost everything it's on Google.
I want to access a service using TCP, .NET4 and VS2010, in C#.
I Have a very tiny service:
namespace WcfService_using_callbacks_via_tcp
{
[ServiceContract(CallbackContract = typeof(ICallback), SessionMode = SessionMode.Required)]
public interface IService1
{
[OperationContract]
string Test(int value);
}
public interface ICallback
{
[OperationContract(IsOneWay = true)]
void ServerToClient(string sms);
}
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
public class Service1 : IService1
{
public string Test(int value)
{
ICallback the_callback = OperationContext.Current.GetCallbackChannel<ICallback>();
the_callback.ServerToClient("Callback from server, waiting 1s to return value.");
Thread.Sleep(1000);
return string.Format("You entered: {0}", value);
}
}
}
With this Web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="WcfService_using_callbacks_via_tcp.Service1" behaviorConfiguration="Behaviour_Service1">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:5050/Service1" />
</baseAddresses>
</host>
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DuplexNetTcpBinding_IService1" contract="WcfService_using_callbacks_via_tcp.IService1"/>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="mexTcp" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<!--
TCP Binding
-->
<netTcpBinding>
<binding name="DuplexNetTcpBinding_IService1" sendTimeout="00:00:01"
portSharingEnabled="true">
</binding>
<binding name="mexTcp" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<!--
Behaviour to avoid a rush of clients and to expose metadata over tcp
-->
<behavior name="Behaviour_Service1">
<serviceThrottling maxConcurrentSessions="10000"/>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
And this code to host it:
static void Main(string[] args)
{
Uri base_address = new Uri("net.tcp://localhost:5050/Service1");
ServiceHost host = null;
try
{
// Create the server
host = new ServiceHost(typeof(Service1), base_address);
// Start the server
host.Open();
// Notify it
Console.WriteLine("The service is ready at {0}", base_address);
// Allow close the server
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
// Close it
host.Close();
}
catch (Exception ex)
{
// Opus an error occurred
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(string.Format("Host error:\r\n{0}:\r\n{1}", ex.GetType(), ex.Message));
Console.ReadLine();
}finally
{
// Correct memory clean
if(host != null)
((IDisposable)host).Dispose();
}
}
Now I want to create the client, but I it is not posible. I've used Add Service Reference and svcutil directly, but I am receiving this error:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>svcutil.exe
net.tcp://loc alhost:5050/Service1 Microsoft (R) Service Model
Metadata Tool [Microsoft (R) Windows (R) Communication Foundation,
Version 4.0.30319.1] Copyright (c) Microsoft Corporation. All rights
reserved.
Attempting to download metadata from
'net.tcp://localhost:5050/Service1' using W S-Metadata Exchange. This
URL does not support DISCO. Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version
4.0.30319.1] Copyright (c) Microsoft Corporation. All rights reserved.
Error: Cannot obtain Metadata from net.tcp://localhost:5050/Service1
If this is a Windows (R) Communication Foundation service to which you
have acce ss, please check that you have enabled metadata publishing
at the specified addr ess. For help enabling metadata publishing,
please refer to the MSDN documentat ion at
http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error
URI: net.tcp://localhost:5050/Service1
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost: 5050/Service1'.
The socket connection was aborted. This could be caused by an error processi ng your message or a receive timeout being exceeded by
the remote host, or an un derlying network resource issue. Local
socket timeout was '00:04:59.9863281'.
Se ha forzado la interrupción de una conexión existente por el host remoto
If you would like more help, type "svcutil /?"
So, I can host the service without problems but I can not create the proxies.
I've tried almost any config I've found, but I think the current web.config is correct. There are the behaviours, the security, and the bindings using mex, used by the endpoints.
I've tried to create an app.config and set it to the same folder with svcutil.exe.
You are missing service configuration
<system.serviceModel>
<services>
<service name="WcfService_using_callbacks_via_tcp.Service1"
behaviorConfiguration="Behavior_Service1">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:5050/Service1" />
</baseAddresses>
</host>
<endpoint address="" contract="WcfService_using_callbacks_via_tcp.IService1"
binding="netTcpBinding" bindingConfiguration="DuplexNetTcpBinding_IService1" />
<endpoint address="mex" contract="IMetadataExchange" binding="mexTcpBindng" />
</service>
</services>
...
</system.serviceModel>
With this config you should not need to define base address in code.
I received the same error while attempting to update an existing service reference. It turns out I had data contracts with the same name within the same namespace. Further investigation yielded the real error:
DataContract for type [redacted] cannot be added to DataContractSet since type '[redacted]' with the same data contract name 'DocumentInfo' in namespace '[redacted]' is already present and the contracts are not equivalent.
I changed the DataContract to provide a name for one of the classes.
[DataContract(Namespace = "urn:*[redacted]*:DataContracts", Name = "SC_DocumentInfo")]
I'm posting this here in case it might help someone with the same issue.
I was getting the same error message and as it turned out, the issue was due to text within a comments block
<!-- comments included characters like à, ç and ã -->
After removing such characters from the commented block, everything works fine
Maybe it will be helpful for someone.
My issue was in a contract argument, and I discovered it with help of Event Viewer:
The operation [Name of method] either has a parameter or a return type that is attributed with MessageContractAttribute. In order to represent the request message using a Message Contract, the operation must have a single parameter attributed with MessageContractAttribute. In order to represent the response message using a Message Contract, the operation's return value must be a type that is attributed with MessageContractAttribute and the operation may not have any out or ref parameters.
So, if you appended more than one arguments, already having [MessageContract] argument, then you'll see error in question. Completely not obvious.
I had the same problem (when client didn't "see" the service in "Add service reference" menu) while using only tcp binding. After trying to add Behavior I had my service to end with exception because it didn't find proper address.
I don't know if it is the best idea, but you can add second base address as http.... here is my config and code, it works.
<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <services>
<service name="TestBindings.StockQuoteService">
<host>
<baseAddresses>
<add baseAddress="net.tcp://10.62.60.62:34000/StockQuoteService" />
<add baseAddress ="http://10.62.60.62:12000/StockQuoteService"/>
</baseAddresses>
</host>
<endpoint address=""
contract="TestBindings.IStockQuoteService"
binding="netTcpBinding" />
</service>
</services>
And the code
class Program
{
static void Main(string[] args)
{
ServiceHost sh = new ServiceHost(typeof(StockQuoteService));
ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
behavior.HttpGetEnabled = true;
sh.Description.Behaviors.Add(behavior);
sh.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(),
"mex");
sh.Open();
The http address is now usend by client to add service reference, and automatically generated config on client side uses net.tcp protocol to call the function.
There is yet another reason to run into this one. Similar to the DataContract related answer here, WCF services also don't support method overloading in operation contracts. It'll raise this confusing catch-all exception as well.
The fix is simple enough:
[OperationContract]
T[] Query(int id);
[OperationContract(Name = "QueryWithArg")]
T[] Query(int id, string arg);
For the above issue check the reference.svc file which is generated at the time you add the reference. The url mentioned in that will be used for updating the service so you can check whether that is running or not.

BadImageFormatException IIS hosted WCF service Win7 x86, VS2010b2

My system is Windows 7 Ultimate 32 bit. Running Visual Studio 2010 beta 2 targeting .Net 4.
I have a project containing service contracts.
A project containing the services.
And an ASP.NET Web Application that is hosting the services in IIS.
I've written my own Clients using the ChannelFactory().CreateChannel()...
Whenever I run my application that uses the ServiceClient and calls a method on the service, I get this error:
An attempt was made to load a program with an incorrect format.
(Exception from HRESULT: 0x8007000B)
I've tried to add a service reference in VS, so that the service client is auto-generated and that doesn't change anything.
Then I tried to create a new WCF Service Application from the Web category in VS2010, adding a service reference and calling the standard GetData method That works fine, so it is for sure my service or the hosting of the service that goes wrong...
UPDATE
I noticed that this error was only present when using wsHttpBindings. basicHttpBindings works fine.
This is how I instantiate the service:
private IAdminService _AdminService;
public AdminServiceClient()
{
_AdminService = new ChannelFactory<IAdminService>(String.Empty)
.CreateChannel();
}
Client config settings:
<system.serviceModel>
<client>
<endpoint address="http://AdminServices/svcs/AdminService.svc"
binding="wsHttpBinding"
contract="MyApp.Admin.Model.ServiceContracts.IAdminService" />
</client>
</system.serviceModel>
My service looks like this:
public class AdminService : IAdminService
{
public User GetUserByEmail(string email)
{
throw new NotImplementedException();
}
public void CreateUser(string fullname, string email,
string encryptedPassword,
string encryptedPasswordQuestion,
string encryptedPasswordAnswer)
{
throw new NotImplementedException();
}
public IEnumerable<Application> GetApplications()
{
IEnumerable<Application> apps = new List<Application>();
// Call data access layer method to retrieve Applications
return apps;
}
public IEnumerable<ApplicationInstance> GetApplicationInstances(
long? applicationId)
{
throw new NotImplementedException();
}
public Dictionary<string, string> GetApplicationsAndInstances()
{
Dictionary<string, string> appsAndInstances =
new Dictionary<string, string>();
appsAndInstances.Add("Dummy 1", "1");
appsAndInstances.Add("Dummy 2", "2");
return appsAndInstances;
}
}
My AdminService.svc file looks like this:
<%# ServiceHost Service="MyApp.Admin.Services.AdminService" %>
My Service Host config looks like this:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true"
targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="MyApp.Admin.Services.AdminService">
<endpoint address=""
binding="wsHttpBinding"
contract="MyApp.Admin.Model.ServiceContracts.IAdminService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
I've also tried to create a new Console App, and add a service reference to http://AdminServices/svcs/AdminService.svc - that doesn't work either.
I've added AdminServices to my hosts file, and I can browse http://AdminServices/svcs/AdminService.svc and see the service information...
The most obvious cause would be that you are loading a 64 bits DLL into a 32 bits process or visa versa. However given that you are running everything on a a 32 bits development box I assume this isn't the case.
The other option is a .NET bug using a generic constraint like this:
public class SpecificClass: BaseClass: where T : class { }
If you remove the where T : class it should work just fine.