This service I can see the JSON data while calling methods through browser when hosted on our IIS server but after moving it to client's server.. I can't see the data from browser though I can see through WCF Test CLient only... where I'm going wrong.. Could you suggest what should be done.
<bindings>
<wsHttpBinding>
<binding name="LargeSettings" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600">
<readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="mobserviceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="clubconnect.mobservice" behaviorConfiguration="mobserviceBehavior">
<endpoint address="" binding="wsHttpBinding" contract="clubconnect.imobservice" bindingConfiguration="LargeSettings"/>
<endpoint address="ws" binding="webHttpBinding" contract="clubconnect.imobservice" behaviorConfiguration="WebBehavior">
<identity>
<dns value="http://domain"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
You need to add a base address in there:
<host>
<baseAddresses>
<add baseAddress="http://<URL to the .svc file>" />
</baseAddresses>
</host>
Then your relative address for your webHttpBinding endpoint "ws" will resolve to
http://<URL to the .svc file>/ws
Related
I have create iis server on remonte machine (Windows Server 2008 R2). This is my web.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="Binding" closeTimeout="00:05:00" sendTimeout="00:10:00" />
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="DictionaryServiceBehaviors">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="DictionaryServiceBehaviors" name="BandD.Serwis.SerwisISS.Service.DictionariesService">
<endpoint address=""
binding="wsHttpBinding"
contract="BandD.Serwis.SerwisISS.Interface.IDictionariesService"
bindingConfiguration="Binding"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://xxx.xxx.199.89:7833/BandD.Serwis.SerwisISS.Service/DictionariesService/"/>
</baseAddresses>
</host>
</service>
</services>
That is app.config for client application:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IDictionariesService" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://xxx.xxx.199.89:7833/Service/DictionariesService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDictionariesService"
contract="DictionariesService.IDictionariesService" name="WSHttpBinding_IDictionariesService">
</endpoint>
</client>
I have add IIS server role to my remote machine, i set physical path to locate publised file from server application (publised from VS). All of authentication i set to Disabled, only Anonymous Authentication is Enabled.
When i try connect to WSDL with SoapUi i go error:
Error getting response; java.net.UnknowsHostException: winserver2008
When i want connect to server with client app i must write username and password (administrator password don't work).
What i must do to can connect to server without authentication. What i should change on server(Windows server) or app.config to can connect correctly.
Probably i have bed web/app.config
Ok i found solution:
On MS Server i change for now website connect as (in bassic setting) to administrator. This is only for now and i change it later.
Second i change web.config on server:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="Binding" closeTimeout="00:05:00" sendTimeout="00:10:00">
<security mode="None" />
<reliableSession enabled="true" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="DictionaryServiceBehaviors">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="DictionaryServiceBehaviors" name="BandD.Serwis.SerwisISS.Service.DictionariesService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding"
contract="BandD.Serwis.SerwisISS.Interface.IDictionariesService" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
name="mex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://http://xxx.xxx.199.89:7833/Service/DictionariesService" />
</baseAddresses>
<timeouts closeTimeout="00:01:00" openTimeout="00:10:00" />
</host>
</service>
</services>
At last i change client app config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IDictionariesService">
<reliableSession enabled="true" />
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://xxx.xxx.199.89:7833/Service/DictionariesService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDictionariesService"
contract="DictionariesService.IDictionariesService" name="WSHttpBinding_IDictionariesService" />
</client>
</system.serviceModel>
I have a WCF service nested in an ASP.NET 4.5 web application and everything was running without issue until I attempted to specify a port. I have to run on a separate port as per my client's requirements but I cannot figure out what I am doing wrong.
For now I am running everything local and I did punch holes in my firewall so I know that is not the issue. The error I get - System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:59031 - tells me that I have no listener attached so, again, it must be my config. Right?
Here is a call:
http://localhost:59031/seoland/seo.svc/Login?User=test&Pass=pass
And here is my config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
<services>
<service name="seoland.extranet.seo">
<endpoint address="" behaviorConfiguration="json" binding="webHttpBinding" name="MainHttpPoint" contract="seoland.extranet.seo">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" name="MexEP" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:59031/seoland/seo.svc"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<webHttpBinding>
<binding openTimeout="00:10:00" sendTimeout="00:10:00" useDefaultWebProxy="false">
<readerQuotas maxDepth="32" maxStringContentLength="2048000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="json">
<webHttp helpEnabled="false" automaticFormatSelectionEnabled="false" defaultBodyStyle="Bare"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding" httpGetBindingConfiguration=""/>
<serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="false" includeExceptionDetailInFaults="true"/>
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="http" port="59031"/>
</defaultPorts>
</useRequestHeadersForMetadataAddress>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Again everything worked until I tried adding the port number - can somebody please help me out?
Thanks!
Are you using the correct port number? Also, make sure that there is no firewall restrictions and the port is open.
Getting the following error when attempting to start a Windows service hosting a WCF service:
Could not find a base address that matches scheme net.msmq for the endpoint with binding NetMsmqBinding. Registered base address schemes are [http].
Works fine if I remove the netmsmq binding and use the basichttp binding. Config is as below:
<system.serviceModel>
<services>
<service name="ManageContactService.ManageContact" behaviorConfiguration="ContactServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8888/ManageContact/ContactService"/>
</baseAddresses>
</host>
<endpoint address="net.msmq//localhost/private/testqueue" binding="netMsmqBinding"
bindingConfiguration="MyMsmqBinding" contract="ManageContactService.IManageContact" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<netMsmqBinding>
<binding name="MyMsmqBinding">
<security mode="None"></security>
</binding>
</netMsmqBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ContactServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
You need a colon:
net.msmq://localhost/private/testqueue
hi im working on wcf that has http + tcp services
thats my config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix="http://localhost/API/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
</webHttpEndpoint>
</standardEndpoints>
<services>
<service name="API.APIsrv" behaviorConfiguration="ServiceBehaviour">
<endpoint address="http://localhost/tAPI/Basic" binding="basicHttpBinding" name="Basic" bindingConfiguration="Basic" contract="API.IAPIsrv" >
</endpoint>
<endpoint address="http://localhost/API" binding="webHttpBinding" name="APIsrv" contract="API.IAPIsrv" behaviorConfiguration="web">
</endpoint>
<endpoint address="net.tcp://localhost/API" binding="netTcpBinding" name="APIsrv.netTcpBinding" contract="API.IAPIsrv">
</endpoint>
<endpoint address="http://localhost/API/mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<endpoint address="net.tcp://localhost/API/mex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost/API/APIsrv.svc"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="Basic" />
</basicHttpBinding>
<netTcpBinding>
<binding name="APIsrv.netTcpBinding" transferMode="Streamed" maxReceivedMessageSize="20480000">
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>
in my global file i handle route address:
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(new ServiceRoute("", new ServiceHostFactory(), typeof(APIsrv)));
}
in my local client test i get this error:
The service '/API/' cannot be activated due to an exception during compilation. The exception message is: The ChannelDispatcher at 'http://localhost/API/Basic' with contract(s) '"IAPIsrv"' is unable to open its IChannelListener.
how can i fix this issue
I have SSL working for my SOAP endpoint.
But as soon as I enable my REST endpoint, it throws a fit:
Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https].
My app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="IIncreasedBufferSize" maxBufferSize="1024000"
maxReceivedMessageSize="1024000">
<readerQuotas maxArrayLength="1024000" />
<security mode ="Transport">
<transport clientCredentialType= "None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="WCFBehaviourSSL"
name="IWCF.IService">
<endpoint name="soap" address="soap" binding="basicHttpBinding" bindingConfiguration="IIncreasedBufferSize"
contract="IWCF.IServices">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint name="rest"
address="rest"
binding="webHttpBinding"
contract="IWCF.IServices"
behaviorConfiguration="REST" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary2/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="REST">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="WCFBehaviourSSL">
<serviceMetadata httpGetEnabled="False" httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
I found this question: REST WCF Service Over SSL
But rest assured, None of the answers provided are of use.
I have certificates, and it does work with SSL using the SOAP end point. (when rest endpoint is commented out).
I was missing a WebHTTPBinding, that uses Transport security:
<webHttpBinding>
<binding name ="REST SSL">
<security mode ="Transport">
<transport clientCredentialType= "None" />
</security>
</binding>
</webHttpBinding>
. . .
<endpoint name="rest"
address="rest"
binding="webHttpBinding"
contract="IWCF.IServices"
behaviorConfiguration="REST"
bindingConfiguration="REST SSL"/>