I've created a new WCF Workflow Service project in VS2012.
Ultimately, what I need is the ability to terminate instance B of my workflow from instance A of my workflow.
As best I can tell, the only way to achieve that is via the Workflow Control Endpoint, but I can't figure out how to add/access that to my project.
From what I've seen (e.g. here), to add the control endpoint, you just add an <endpoint> element to <service> node in web.config with the appropriate attribute values. The problem is.. I don't have a <service> element in my web.config. The "WCF Workflow Service Application" project template does not add one. My web.config is below.
So my question is simply: Starting from the "WCF Workflow Service Application" project template, how do I add a Workflow Control Endpoint?
These are the default launch settings for the project:
web.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" >
</compilation>
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Finally found a solution for this. See this post.
Related
I've been facing a tough issue for three days. I have a WCF web api (.svc service file) deployed to an IIS 8.5. The application was working properly and then, suddenly, after I changed some other minor things inside the code, this problem arises: I can connect to the application from inside the server (using localhost). I can connect from outside, using the server IP address. But I cannot, by any means, connect from the outside by using server hostname. The problem is best understood through the examples bellow:
Note: the application is an IIS app inside the main Web Site. The service's URI is http://myhostname/api/servicos.svc
http://localhost/api/servico/some_request: works!
http://server_ip_address/api/servico/some_request: works!
http://myhostname.com/api/servico/some_request: DOES NOT WORK!
I have searched through many websites and forums but of no avail.
My web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<customErrors mode="Off" />
</system.web>
<connectionStrings>
<!-- My connection string goes here -->
</connectionStrings>
<system.serviceModel>
<services>
<service name="ServicoWeb.servico" behaviorConfiguration="Wcf_Behavior">
<endpoint name="" binding="webHttpBinding" contract="ServicoWeb.IServico" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp automaticFormatSelectionEnabled="true" defaultBodyStyle="Bare" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Wcf_Behavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="removeSvcDaUrl" type="ServicoWeb.Validacao.UrlCustomizacao, ServicoWeb" />
</modules>
<directoryBrowse enabled="true" />
<rewrite>
<rules>
<remove name="WordPress: https://myhostname.com" />
</rules>
</rewrite>
<handlers accessPolicy="Read, Execute, Script" />
<security>
<requestFiltering>
<verbs>
<add verb="*" allowed="true" />
</verbs>
</requestFiltering>
</security>
</system.webServer>
</configuration>
The error I am presented to when trying to access the API from outside (via hostname) is this:
Server Error in '/Api' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly.
Requested URL: /Api/servico.svc/asos/csv/09655055000104
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.6.1069.1
Do you have any idea what should I do in order to fix this bug?
Edit: one more information: other apps inside the same web site in IIS works FINE! There are even other web apis written in C#, just like this one here, and they all work properly.
Edit 2: another thing important to say is that I can access the service path until the service itself (servico.svc). So, for example, when I try to access "http://myhostname.com/api/servico.svc?wsdl" I successfully get the service's metadata. So, only when I try to access the service itself I get the error mentioned above.
There is a file named host file. When you try request a DN windows look into that file. That file inside C:\WINDOWS\System32\drivers\etc there is host file. Append like below this in your host file (with admin mode).
server_ip_address myhostname.com
I finally got it solved! For those struggling with this issue without sucess: Amazon EC2 load balance was the cause of my troubles.
It happened that Load Balance was set up to filter all requests and send them to the server machines using transport layer SSL security protocol (HTTPS). So, if I were to request http://myserver.com/servico Amazon Load Balance would internally redirect to https://machine-n/servico where 'n' is the machine used (in my case, I have two machines).
So, what caused my issue, inside WCF, was this: my web.config was not allowing the service to accept HTTPS requests. Once I fixed this, everything worked fine.
It also explains why everything worked when I requested directly using the machine's IP address using HTTP: load balance did not play any role in this case filtering the request and redireting using HTTPS.
So, here we have my web.config, now allowing HTTPS requests:
<?xml version="1.0" encoding="UTF-8"?>
...
<system.serviceModel>
<services>
<service name="ServicoWeb.servico" behaviorConfiguration="Wcf_Behavior">
<endpoint name="" binding="webHttpBinding" contract="IServico" bindingConfiguration="webHttpTransportSecurity" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webHttpTransportSecurity">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp automaticFormatSelectionEnabled="true" defaultBodyStyle="Bare" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Wcf_Behavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
...
In my case below things helped :
Check protocolMapping is binded correctly.
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
Check 443 port is open and working.
Hi I am developing small application using WCF,MVC4 and angularJS. I am refering following URL
https://code.msdn.microsoft.com/AngularJS-Shopping-Cart-8d4dde90#content
When i tried to add service reference in my mvc application I am getting below error
Metadata publishing for this service is currently disabled.
I gave below url to access service.
http://localhost:55835/Service1.svc
When i tried I am getting error. I am unable to add service reference in my application. I am little worried about my web.config file. This is my web.config file.
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp helpEnabled="True"/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="webHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Can someone tell me something I am missing anything in config file?
Thank you in advance.
This problem is displaying because you are not enabling metadata.Metadata(wsdl document for your service code) is neccessary because your client will generate proxy class on the basis of your metadata(wsdl code). If you will not enable your metadata then your client will never know how to implement the same kind of code in its's proxy classes.And this can be enabled under servicemetadata tag under servicebehavior tag by setting httpGetEnabled to true.
Add this line of code under servicebehavior tag just after </endpointBehaviors> tag.(please do not include <behaviour> tag again)
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" httpGetUrl="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
how can I reference WCF to my .NET Core client? I download and install "WCF Service Preview" plugin but when I trying add reference I got error
Error: No endpoints compatible with .Net Core apps were found.
An error occurred in the tool.
Failed to generate service reference.
When I try service in my browser, works fine. Any ideas ?
My WCF's web config:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
</httpModules>
</system.web>
<system.serviceModel>
<services>
<service name="ServiceLayer.TeamManagementService" behaviorConfiguration="GetDataBehavior">
<endpoint address="" binding="webHttpBinding" contract="ServiceLayer.ITeamManagementService" behaviorConfiguration="GetDataEndpointBehavior"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="GetDataBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="GetDataEndpointBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
Uncheck Reuse types in referenced assemblies.
I faced a similar problem a couple of days ago and could not find a specific reason to why the endpoint was not recognized correctly by the extension. I solved this by creating a class library project that includes a proxy for the actual WCF service. The NET Core project can then reference this project and indirectly call the service without connected references.
If you haven't found a solution to the problem yet, have a look at my github repository to see an example:
https://github.com/jolmari/netcore-wcf-service-proxy
I am trying to deploy an WCF, using Internet Information Service. I worked with visual studio 2015. But i got this error:
Configuration binding extension 'system.serviceModel/bindings/true'
could not be found. Verify that this binding extension is properly
registered in system.serviceModel/extensions/bindingExtensions and
that it is spelled correctly.
My Web.config is the following:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="false" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.serviceModel>
<services>
<service name="ClientWebS.UserService"
behaviorConfiguration="mex">
<endpoint address="UserService" binding="wsHttpBinding"
contract="ClientWebS.IUserService"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mex">
<serviceMetadata httpGetBinding="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
Thanks for help!!
I tried to find web.config for my WCF service connect to server using REST call. However, its saying unable to connect server. Here is my web.config:
<?xml version="1.0"?>
<configuration>
<!--<system.net>
<defaultProxy useDefaultCredentials="true" >
</defaultProxy>
</system.net>-->
<appSettings>
<add key="UserName" value="admin"/>
<add key="Password" value="admin"/>
<add key="resturl" value="https://Clientname.atlassian.net/rest/api/2/"/>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IJiraService"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:19065/JiraService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IJiraService" contract="ServiceReference1.IJiraService"
name="BasicHttpBinding_IJiraService" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
Could anyone please help me, how can I correct this? I tried on net, however, not able to find any suitable tutorial for this. Please help.
This is resolved. Its was a proxy issue and after adding proxy to browser and IIS the issue got resolved. Thanks.