I have testing WCF service and i want to deploy it for development purposes to IIS Express (not classical IIS)
part of my Web.config
</serviceHostingEnvironment>
<services>
<service name="WcfService1.Service1" behaviorConfiguration="test">
<endpoint binding="basicHttpsBinding" contract="WcfService1.IService1" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="test">
<serviceMetadata httpGetEnabled="False" httpsGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials>
<serviceCertificate findValue="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindByThumbprint" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
When i deploy it on IIS express everything works fine... Except it is on port 44300 (that is ok) but it use IIS Express own certificate generated on iis express installation.
I clearly specify so he should use my certificate located by thumbprint and by value "XXXXXXX...."
How to force IIS express to respect that service behavior part ?
There is a nice blog post by #SCOTT HANSELMAN on this:
http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
OK so i have a solution.
What i wrote is different kind of certificate - its for service authentication on client.
Certificate used for SSL connection establish is really set with this command:
netsh http add sslcert ipport=0.0.0.0:443 appid={214124cd-d05b-4309-9af9-9caa44b2b74a} certhash=YOURCERTHASHHERE
Azure projects - web roles do this on project startup automaticaly.
Related
I'm trying to make a certificate based authentication platform for my WCF service, and I've followed all the tutorials and made my certificate and installed it in IIS and everything works great running locally, but as soon as I publish it to Azure I get the exception
Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindBySubjectName', FindValue 'CN=tempCert'.
I've uploaded the .pvk to azure
I've put it in my settings
And I made sure to add it to my app settings for the website
However it still does not work once I publish it. This is my configuration in my Web.Config file for the service model
<system.serviceModel>
<services>
<service name="clientSecurity">
<endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding"
name="wsHttpEndpoint" contract="uConnect.Web.IUConnectService" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding">
<security>
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client />
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate findValue="CN=tempCert" x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
And as I mentioned it works perfectly when I run it locally, it only throws an exception once I publish it to azure. Any help would be welcome since I've been trying to fix this for some time now.
You need to specify the certificate store, in Azure WebApps - these get loaded in currentUser. Add storeLocation="CurrentUser" storeName="My" to the serviceCertificate element.
I have a running, mature WCF service that I am trying to deploy on Windows Azure as a Web Role (with a custom wrapper, of course). My RoleEntryPoint.OnStart() method creates a ServiceHost instance, where it trips with the zero application endpoints error. The configuration (web.config) service model section is:
<system.serviceModel>
<services>
<service name="Linguasys.QualitativeAnalysis.Processing" behaviorConfiguration="defaultServiceBehavior">
<endpoint address="" behaviorConfiguration="wcfAzureWrapperStoryMapping.StoryMapperAspNetAjaxBehavior" binding="webHttpBinding" contract="Linguasys.QualitativeAnalysis.IProcessing" />
<!--
<endpoint address="soap" behaviorConfiguration="" binding="basicHttpBinding" contract="Linguasys.QualitativeAnalysis.IProcessing" />
-->
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="wcfAzureWrapperStoryMapping.StoryMapperAspNetAjaxBehavior">
<!--
<enableWebScript />
-->
<webHttp faultExceptionEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="defaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding></webHttpBinding>
<basicHttpBinding></basicHttpBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
<!--
<serviceActivations>
<add relativeAddress="StoryMapper.svc" service="Linguasys.QualitativeAnalysis.Processing"/>
</serviceActivations>
-->
</serviceHostingEnvironment>
</system.serviceModel>
Never mind the activation bits, the basic HTTP binding, etc. They were added later to see whether it will work.
I see that my web.config ends up at the siteroot and approot and all the other places.
What am I missing?
Your RoleEntryPoint.OnStart() method runs in WaIISHost.exe which does not know anything about your web.config. For more info see http://azure.microsoft.com/blog/2010/12/02/new-full-iis-capabilities-differences-from-hosted-web-core/, and for information about how the processes run see http://blogs.msdn.com/b/kwill/archive/2011/05/05/windows-azure-role-architecture.aspx.
Two options:
Move your WCF configuration to WebRole1.dll.config (or whatever your role entry point binary's name is). Make sure you set the .config to Content and copy local.
Instantiate your ServiceHost in w3wp (ie. Global.asax).
This question already exists:
support about Web service when hosting in IIS
Closed 9 years ago.
I writing a Web service, when I run it in localhost, everything is OK, but I host in IIS 7.0 , it's not running. Please support me!!!
Here my Web.config
<system.serviceModel>
<services>
<service name="VivuFace_V2.api.CloudCameraService" behaviorConfiguration="VivuFace_V2.api.CloudCameraServiceBehavior">
<endpoint address="../CloudCameraService.svc"
binding="webHttpBinding"
contract="VivuFace_V2.api.ICloudCameraService"
behaviorConfiguration="webBehaviour" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="VivuFace_V2.api.CloudCameraServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webBehaviour">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
This is very open ended since there is no error message here, but my experience is that a lot of the time issues related to hosting under IIS is due to the following:
Make sure your app pool is configured for the right version of Net
Make sure asp.net support is installed in IIS
Make sure permissions are configured correctly
BACKGROUND
We have a WCF web service hosted in a Windows Service running with the basicHttpBinding.
PROBLEM
Browsing to the service URL on the local machine works fine, but trying to browse using the external IP address (either remotely or EVEN locally) does not work. Example:
http://localhost:8000/booking.svc (OK)
http://<external-IP>:8000/booking.svc (Not OK)
APP.CONFIG
<system.serviceModel>
<services>
<service behaviorConfiguration="DefaultServiceBehavior" name="HotelManagementSystem.ServiceHost.BookingService">
<endpoint address="" binding="basicHttpBinding" contract="HotelManagementSystem.ServiceHost.IBookingService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/booking.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Anyone have any ideas?
Try using useRequestHeadersForMetadataAddress
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<useRequestHeadersForMetadataAddress />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
This will allow the service to insert the URI you used to access the service in to the metadata so the wsdl aligns. Sometimes you'll go to access http://1.2.3.4/service.svc but the metadata will reference http://localhost. Locally that's fine, but remotely that makes grabbing the endpoint information impossible. Instead, now all those localhost references will use 1.2.3.4 instead.
I recently built a WCF Service, and now I'm deploying it to Windows Server 2008. Right now, we don't have secure protocol turned on. But we will. I'd like to get it working either way. In the site, I've had Anonymous authentication enabled as well as Forms authentication. The reason I did this was to prevent the authentication popup on the iPad, Android and Internet Explorer. So now they just get to the Login screen. Oh and I did activate WCF in Windows features. If you're also knowledgeable about making this https ready, I'd also like to figure that out. Thanks!!
I'm getting this error when I try pasting in the *.svc PATH into the URL.
System.ServiceModel.ServiceActivationException:
The service
'/WCFServices/Accessioning/QuickDataEntryService.svc'
cannot be activated due to an
exception during compilation
Here is my web.config configuration thus far.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<!--<baseAddressPrefixFilters>
<add prefix="http://localhost/" />
</baseAddressPrefixFilters>-->
</serviceHostingEnvironment>
<behaviors>
<endpointBehaviors>
<behavior name="AspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
<!-- Watch this section when adding a new WCF Service! New behaviors will be added; just delete them and use "ServiceBehavior" -->
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceBehavior" name="A.LIMS.UI.Web.WCFServices.Accessioning.QuickDataEntryService">
<endpoint behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding"
contract="A.LIMS.UI.Web.WCFServices.Accessioning.QuickDataEntryService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<!--<service name="A.LIMS.UI.Web.WCFServices.Accessioning.IQuickDataEntryService"
behaviorConfiguration="ServiceBehavior">
<endpoint behaviorConfiguration="AspNetAjaxBehavior"
binding="webHttpBinding"
contract="A.LIMS.UI.Web.WCFServices.Accessioning.IQuickDataEntryService" />
</service>-->
<!-- Watch this section when adding a new WCF Service! Duplicate the "QuickDataEntryService" above for an example, but change the fully qualified name -->
</services>
</system.serviceModel>
I have no clue what caused the exception above, but here was the final verdict. There were a lot of things required for WCF and using an SSL certificate (HTTPS protocol). Pardon the formatting.. I don't like how Stack Overflow sometimes puts the code into a block and sometimes it doesn't.
The following were required for the web.config on HTTPS:
Here are some places that required the "requireSSL" attribute:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="30" protection="All" requireSSL="true" />
</authentication>
<httpCookies httpOnlyCookies="false" requireSSL="true" domain="" />
Notice the "s" in "httsGetEnabled" below:
<behaviors>
<endpointBehaviors>
<behavior name="AspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
Bindings (missing in non-SSL web.config):
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
Services (notice the "s" in "mexHttpsBinding"):
<services>
<service behaviorConfiguration="ServiceBehavior" name="A.LIMS.UI.Web.WCFServices.Accessioning.QuickDataEntryService">
<endpoint behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" contract="A.LIMS.UI.Web.WCFServices.Accessioning.QuickDataEntryService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
Last but not least. I'm not using .NET 4.0, but I did try .NET on a different machine. With .NET 4.0 I couldn't get the WCF services to work without having this configured to the actual URL being used. If there were two domains for the same IP, WCF only worked with the domain in this block inside the system.ServiceModel XML block in the web.config. I did not test https in the .NET 4.0, so I'm assuming the protocol on the URL would be https below:
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix="http://subdomain.domain.com/" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
Oh, I also had to turn on WCF on the Windows Server 2008 box. And it required a server reboot!