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.
Related
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
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
I've set up a WCF service to require NTLM authentication using the following configuration:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="BinarySecurityBinding">
<binaryMessageEncoding/>
<httpTransport authenticationScheme="Ntlm"/>
</binding>
</customBinding>
</bindings>
<services>
<service name="Services.LogisticsServices" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="customBinding" bindingConfiguration="BinarySecurityBinding" contract="Services.ILogisticsServices" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
I did this so that the applications that consume the web service are forced to log in because all my service's operations use impersonation ([OperationBehavior(Impersonation = ImpersonationOption.Required)]).
In IIS 7 I've enabled anonymous and Windows authentication.
When I visit http://test.server/LogisticsServices.svc, which hosts the service described above, I can see the default service description page anonymously. However, when Visual Studio tries to access http://test.server/LogisticsServices.svc/$metadata to generate a client proxy, the server is responding with HTTP code 401 and expecting authentication. Not only would I've expected the metadata to be available anonymously, but additionally, the server is not accepting the credentials I am giving it (even though, I know for a fact that they are correct).
Testing different configuration, I tried removing the authenticationScheme from my binding's transport, just to be able to generate the client proxy, but that results in an exception because the service's operations require impersonation ([OperationBehavior(Impersonation = ImpersonationOption.Required)]).
What am I missing in my service's configuration that would make the service's metadata available anonymously? I'm also open to suggestions if I'm approaching the whole thing wrong.
here is a similar discussion:
Getting an Security setting exception while accessing a WCF service
One way around this is not to use the autogenerated proxies.
In cases where we have control over both the server and the client we have found that it is much more productive to avoid using the autgenerated proxies.
A screencast of how to do this can be found here: http://www.dnrtv.com/default.aspx?showNum=122
You could try imperative instead of declarative model, see: http://msdn.microsoft.com/en-us/library/ms730088.aspx
I have a simple WCF service (hosted as its own site in IIS). It was originally developed targeting .NET 4 but I have recently discovered that it needs to be downgraded to .NET 3.5.
I never touched the web.config file and it Just Worked. Now that I've changed the project from .NET 4 back to 3.5 I'm getting config errors. The first one was about multipleSiteBindingsEnabled not being recognised - a quick search tells me this is new in .NET 4 so I just deleted it. Now the error I'm getting is:
Service 'MyService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
I just want to get the service responding so I can test firing things at it. The system that will be consuming the service doesn't exist yet (it's currently being developed by a government department) so once that's closer to completion we'll be worrying about the config that will be needed for it to go into production etc. What's the minimum config I need in the web.config to make it work for testing?
You need these basic nodes in your service's web.config files usually.
Of Course the binding types / dedub config / etc is all just for testing.
You need to fine tune it as per your needs
<system.serviceModel>
<services>
<service name="A.B.C.D" behaviorConfiguration="returnFaults">
<endpoint contract="A.B.C.ID" binding="basicHttpBinding" address=""/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="HttpBinding" maxReceivedMessageSize="2097152">
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Has anyone ever tried to use custom binding with SSL in a WCF web service? I've seen a number of examples on how to do this with basicHttpBinding and wsHttpBinding but the equivalent always fails for customBinding. Specifically what I'm currently working with (the most successful configuration yet) looks something like this:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="binaryHttps">
<binaryMessageEncoding />
<httpsTransport />
</binding>
</customBinding>
</bindings>
<services>
<service behaviorConfiguration="MyServiceBehavior" name="MyService">
<host>
<baseAddresses>
<add baseAddress="https://(myserver)/"/>
</baseAddresses>
</host>
<endpoint address=""
binding="customBinding" bindingConfiguration="binaryHttps"
contract="MyService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
This actually allows us to access the service from the web, get it's WSDL and add a service reference inside visual studio alright, but when we actually try and use it live in our silverlight-3 application, it just sits there indefinitely waiting for a response and never times out. It actually ends up giving me low memory problems after a while on my machine (with 6GB of memory). The odd thing is that all this worked (and still does) perfectly in the development environment (using strictly the VS application hosts), it wasn't until we tried to deploy it to an actual server with a real SSL certificate that all these issues popped up.
I've searched fairly exhaustively for a solution to this problem but have so far not found anything and have tried just about everything - Is there anyone out there that's encountered this before and got around it?
So it turns out the problem wasn't with our web.config at all, it had to do with an issue with IIS 7 and Wildcard SSL certificates.
Namely, IIS 7 doesn't allow you to specify the hostname when binding an IP to an SSL connection and certificate. I'd guess that this is because it expects a non-wildcard SSL certificate that it can extract the explicit hostname from. What we ended up having to do was to go into the applicationHost.config file in {WindowsDir}\{System32}\{Inetsrv}\{config} and find the entry with our web service's bound IP address and change it explicitly to (ip):(hostname). It was then even displayed properly in the IIS config GUI.
After doing this we were to completely turn off all but SSL channels on all our servers and everything worked beautifully.
Thank god that's over!
AFAIK, using SSL has performance problem. We are using WCF behiovr to do the authentication. The way that we are using is that Silverlight => ASP.NET => WCF. We configured the Endpoint behivor in both Silverlight and WCF. Whenever we call the service, we passed the token for authentication.
Are you saying that you can use custom binding in ClientConfig of Silverlight?