I am getting error when i am trying for both http and net.tcp bindings
and if i use relative address then it is working fine... but i need with absolute only
public interface IService
{
[OperationContract]
string gethello();
[OperationContract]
int add(int x, int y);
}
public class Service : IService
{
public string gethello()
{
return "hi sir";
}
public int add(int x, int y)
{
return x + y;
}
}
<%@ ServiceHost Language="C#" Debug="true" Service="Service" CodeBehind="~/App_Code/Service.cs" %>
end points defined in web.config file are :
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Service">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="http://localhost:7777/WCF2/testservice/Service.svc"
binding="basicHttpBinding" contract="IService" />
<endpoint address="net.tcp://localhost:9999/WCF2/testservice/Service.svc"
binding="netTcpBinding" bindingConfiguration="" contract="IService" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- 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>
</system.serviceModel>
when executing i am geeting error like this :
Server Error in '/WCF2/testservice' Application.
No protocol binding matches the given address 'http://localhost:7777/WCF2/testservice/Service.svc'. Protocol bindings are configured at the Site level in IIS or WAS configuration.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: No protocol binding matches the given address 'http://localhost:7777/WCF2/testservice/Service.svc'. Protocol bindings are configured at the Site level in IIS or WAS configuration.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[InvalidOperationException: No protocol binding matches the given address 'http://localhost:7777/WCF2/testservice/Service.svc'. Protocol bindings are configured at the Site level in IIS or WAS configuration.] System.ServiceModel.Channels.TransportChannelListener.OnOpening() +15759397 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +397 System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) +87 [InvalidOperationException: The ChannelDispatcher at 'http://localhost:7777/WCF2/testservice/Service.svc' with contract(s) '"IService"' is unable to open its IChannelListener.] System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) +15759237 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +563 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +110 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +563 System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +135 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +654 [ServiceActivationException: The service '/WCF2/testservice/Service.svc' cannot be activated due to an exception during compilation. The exception message is: The ChannelDispatcher at 'http://localhost:7777/WCF2/testservice/Service.svc' with contract(s) '"IService"' is unable to open its IChannelListener..] System.ServiceModel.AsyncResult.End(IAsyncResult result) +15778592 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15698937 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +265 System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +227 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171 |