WCF Service Hosting - wcf

I host a WCF Service in IIS, but it is giving following error:-
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
I developed this service in .Net Framework 4.0 and applied basicHttpBinding for SOAP.
I also tried aspnet_regiis.exe -i command but still my problem did not get resolved.
Http Binding is as follow:-
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServBehave">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>

You need to make sure WCF is installed and enabled on the server.
Make sure that the .NET 3.5.1 Framework is installed.
Ensure that “Windows Communication Foundation HTTP Activation is enabled and installed. This can be access via the Program Features in the Control panel under “Turn Windows Features on or off”.
Execute below command from command prompt running as Administrator (elivated privileges ).
"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i

Related

('IntegratedWindowsAuthentication') do not allow those configured on the binding 'WebHttpBinding' ('Anonymous')

I follow this (https://bishwaranjan.wordpress.com/2014/09/05/how-to-upload-files-using-kendo-file-upload-and-wcf-service/) article step by step, but I have the following exption:
The authentication schemes configured on the host ('IntegratedWindowsAuthentication') do not allow those configured on the binding 'WebHttpBinding' ('Anonymous'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly. Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.
I ran into this issue on my dev box this afternoon using Visual Studio 2013 community edition.
My solution was to single click the project name, then change Properties > Development Server > Anonymous Authentication to "Enabled".
Here is a copy of my web.config file as well:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="RiddenGear.AJAX.GuestServicesAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="RiddenGear.AJAX.GuestServices">
<endpoint address="" behaviorConfiguration="RiddenGear.AJAX.GuestServicesAspNetAjaxBehavior" binding="webHttpBinding" contract="RiddenGear.AJAX.GuestServices"/>
</service>
</services>
</system.serviceModel>
As a side bar, please note that this is my dev config. We do run another config for live that forces connections over https. Once you get things rolling in dev you'll likely want to upgrade your config to handle these connections as well.

Adding a WCF Tcp.net service to IIS for Visual Studio 2013 and how to test it

I am trying to deploy a wcf service I have created in Visual studio.
I am almost positive it is a configuration issue in either the wcf service config or in IIS itself.
The config I am using in the service is as follows:
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="CandidateServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" maxConcurrentInstances="500" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="SurveyService.SurveyService" behaviorConfiguration="CandidateServiceBehavior">
<endpoint address="/Survey/SurveyService" binding="netTcpBinding" name="CandidateServiceEndPoint" contract="Prometric.Census.SurveyService.ISurveyService" />
<endpoint address="/Survey/SurveyService/mex" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
</system.serviceModel>
I deployed the service once from visual Studio and pointed a new site on IIS with the following settings pointing to the deployment folder
Then after this within IIS you can see the site is in an unknown status:
It is from here that I can't connect to the service or find if it is running or not. I have tried the command /an : find /i "9015" and found nothing so I assume the service is not even running.
If I where to change the bindings on the WCF service and IIS to use http instead everything works fine. (Should say using http is not an option)
Also on top of not getting the service up and running I'm unsure how to test the service as TCP, Am I able to just add a service reference as you would with a http sefvice? As you can see I am pretty new to the tcp side of things and if I have left out any vital information please let me know so I can inslude it in the question.
This might help you :
https://rohitguptablog.wordpress.com/2011/06/16/configuring-wcf-service-with-nettcpbinding/
I followed this guide to make a net.tcp wcf service and it went smoothly. Also, are you sure that your folder has the required privileges? It can be tricky to use another folder than wwwroot/inetpub

My WCF Service can't run because because the target machine actively refused it 127...:6414

I'm using VS2012.
I made a simple service that I ran yesterday and it worked fine.
But now I'm doing it all again, just to review it, and for my surprise it doesn't work.
Don't know why the machine is actively refusing it 127...:6414.
The service is being run locally, in the same machine, and VS 2012 is being run as Administrator.
This is the complete the error:
"There was an error downloading 'http://localhost:6414/HostDevServer/HelloWorldService.svc'. Unable to connect to the remote server. No connection could be made because the target machine actively refused it 127...:6414"
I tried to make an inbound rule in the firewall, didn't work.
Tried deactivating Microsoft Security Essentials, didn't work.
Tried doing it all in other machine, the same error.
Tried changing the port number, didn't work.
I googled it and what I found wasn't for me.
The service is very simple, the ServiceModel definition in the Web.Config is this:
<system.serviceModel>
<serviceHostingEnvironment >
<serviceActivations>
<add factory="System.ServiceModel.Activation.ServiceHostFactory"
relativeAddress="./HostDevServer/HelloWorldService.svc"
service="MyWCFServices.HelloWorldService"/>
</serviceActivations>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
The service is made with a console application, is being hosted in a new web site that uses IIS Express, all in the same solution.
The property pages for the HostDevServer is:
Whe I run it the WCF Test Client throws the error:
What could it be?
I'd downloaded your project and run it in my machine with no problems. If your problem happens always, it means that your machine has no services listening on the specified port, or there is a firewall stopping you. Try turning of the firewall.
Did you try to debug your web service project only? If so, tell me if you can access to the following URL: http://localhost:PORT_NUMBER/HostDevServer/HelloWorldService.svc, where PORT_NUMBER is the port that you configure for the server in your solution. Try not to use port 80, It's generally used on other applications. Maybe your service isn't starting because of a problem at compile time, so you can try deleting all .pdb files from your bin directory.
Please, try to modify your web.config. Replace your system.serviceModel tag with the following:
<system.serviceModel>
<serviceHostingEnvironment >
<serviceActivations>
<add factory="System.ServiceModel.Activation.ServiceHostFactory"
relativeAddress="./HostDevServer/HelloWorldService.svc"
service="MyWCFServices.HelloWorldService"/>
</serviceActivations>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MyWCFServices.HelloWorldService" behaviorConfiguration="metadataBehavior">
<endpoint
address="" binding="basicHttpBinding" contract="MyWCFServices.IHelloWorldService"/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
In VS2012, Open your "HostDevServer" -> Properties Window (F4) and check the port used at Developer Web Server.URL (http://localhost:<Port Number>), then make sure that Property Pages (Shift+F4).Start Options... .Start URL: is On and set to
http://localhost:<Port Number>/HostDevServer/HelloWorldService.svc

WCF server rejects connections from localhost

I have a WCF service running on a net.tcp port inside a hosting application running on my computer - Windows 2003 64 bit.
The application will accept connections from a colleague's machine and locally from the WCF Test Client and sends back the appropriate information. I can also use my client to connect to the service running on my colleague's machine.
Unfortunately it won't allow me to connect to the service from the client running on my machine. Client on my colleague's machine with server on colleague's machine also fails.
Confusingly, the app also runs another service which works fine locally and remotely.
This works: net.tcp://localhost:8736/EchoExcelServices/
This doesnt: net.tcp://localhost:8736/EchoExcelServices/Uploader
The exception given in the client app is a SecurityNegotiatanException with the message
The server has rejected the client credentials
Inside it (a couple of layers down) is a Win32Exception with the message
The logon attempt failed
EDIT: The behaviours section is as follows:
<behaviors>
<serviceBehaviors>
<behavior name="EchoExcelLibrary.MetadataBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ImpersonationBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
EDIT 2
altered behaviours secion:
<endpointBehaviors>
<behavior name="ImpersonationBehavior">
</behavior>
</endpointBehaviors>
This was a problem with the setup of DTC on our machines. It is now resolved

Generating Client Proxy from a Windows Service

I am trying to generate a client proxy from a WCF service library. I am using VS2005, .NET 3.0 on a Windows XP Pro workstation. The WCF service is hosted in a windows service. When I run the windows service as a console application, there are no problems. I can run svcutil.exe against that address and it generates the proxy. However, when I compile that service in release mode, and install it on the workstation using InstallUtil, I get an error "Error: Cannot obtain Metadata from net.tcp://localhost:9090/Service2 ". These are the settings I am using the app.config for the service
<behaviors>
<endpointBehaviors>
<behavior name="Test2">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="serviceBehaviour">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata />
<!--<serviceMetadata httpGetEnabled="true" />-->
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="TestBinding2" inactivityTimeout = "00:30:00" openTimeout="00:30:00"
receiveTimeout="00:30:00"
sendTimeout="00:30:00">
<binaryMessageEncoding />
<tcpTransport transferMode="StreamedResponse" />
</binding>
</customBinding>
</bindings>
A couple of shots in the dark...
Is your Windows service running? Beyond that, is your WCF service running within the Windows service? My project is also hosting a WCF service in a Windows service (you can see the general step-by-step here). Even though I have the Windows service marked to start automatically, I still have to manually start it the first time. Perhaps there is a command-line option of InstallUtil.exe that I'm not aware of that will do this for me. But the point is, if your Windows service or your WCF service inside is not running, you obviously can't see the MEX endpoint.
The other thing I noticed. Your error says that the metadata cannot be obtained from net.tcp://localhost:9090/Service2, but the base address you posted in your comment shows
net.tcp://localhost:9090/Service_2. Perhaps this is just a type-o, but it wouldn't hurt to double-check that everything is spelled correctly, especially if the add.config is hand-generated.