I hosted webservice in private server. I then created URL rewrite rule in IIS which is there in public server(internet server).
Everytime I access the URL, It explicitly shows the private server's ip/ computer name in URL on browser rather than public url/IP. When I click on the URL for viewing script, it shows "Example.svc does not exist" error.
It also doesn't work when i try to add it as service reference in Visual studio by passing the URL in it. It throws the below error.
The request failed with HTTP status 400: Bad request
Metadata contains a reference that cannot be resolved: <SERVER URL>
The remote server turned an unexpected response: (405) Method not allowed.
What should I do for accessing the URL publicly and also able to add it as reference in Visual studio.?
It seems that you are deploying a WCF service in IIS. Is that correct? If the error “example.svc does not exists” occurred, please ensure that you have enabled certain Windows features in order to host WCF service in IIS.
The reason why we cannot add it as Service Reference in order to call the service is that we have not published the Metadata service endpoint. This depends on your WCF service type. Generally, we either add a Mex service endpoint or publish the service WSDL by adding Metadata service behavior.
<services>
<service name="WcfService1.Service1">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="mybinding" contract="WcfService1.IService1">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
Everytime I access the URL, It explicitly shows the private server's ip/ computer name in URL on browser rather than public url/IP.
In order to access the service by using the hostname/domain name URL, we should ensure that the domain name points to the public IP of the server. It is a network-related issue.
Feel free to let me know if the problem still exists.
i have a WCF service that is hosted in IIS behind a load balancer & the .svc file is at the following URL
https://my-site-domain-Name.xyz.com/test/Service1.svc.
I can successfully browse to the above url and get the page with
"You have created a service.
To test this service, you will need to create a client and use it to
call the service. You can do this using the svcutil.exe tool from the
command line with the following syntax:
svcutil.exe https://server-host-name.xyz.com/test/Service1.svc?wsdl"
NOTICE that i browsed to https://my-site-domain-Name.xyz.com/test/Service1.svc (used the domain name) but the URL returned next to svcutil.exe points at https://server-host-name.xyz.com/test/Service1.svc?wsdl (Uses machine name)
Is that the expected behavior?
Isn't svcutil.exe also supposed to be pointing to this
https://my-site-domain-Name.xyz.com/test/Service1.svc?wsdl
Why is the svcutil.exe pointing to the server machine name and not the domain name?
My binding is defined like below
<endpoint address="" binding="customBinding" contract="App1.IService" bindingConfiguration="myBindingConfig" />
Could it because the endpoint address = "" (empty)?
Trying to now browse to the .svc?wsdl address pointed to by the svcutil.exe returns below error
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.
Use option useRequestHeadersForMetadataAddress in web.config. Example:
<behavior name="TransmiteMensagemTISSBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add port="80" scheme="http"/>
</defaultPorts>
</useRequestHeadersForMetadataAddress>
</behavior>
I want to create a proxy to a remote web service which exposes its WSDL only through HTTPS. I have the certificate details, an I get positive response when using SOAP UI.But I don't want to set JVM -D arguments for keystore & trustore and need Mule SOAP Server Proxy to define them.Below is the snippet which i am using for insecure access to the remote service.
<flow name="remoteProxy" doc:name="remoteProxy">
<http:inbound-endpoint address="http"
doc:name="HTTP" />
<cxf:proxy-service payload="envelope"
wsdlLocation="http://remoteserver.com/service/service26?wsdl" service="ServiceName"
namespace="http://remoteserver.com/provider/service/2012/" port="Port"
doc:name="SOAP">
</cxf:proxy-service>
<https:outbound-endpoint address="http://remoteserver.com/service/service26"
method="POST" doc:name="HTTPTo26"
exchange-pattern="request-response"/>
<cxf:proxy-client payload="envelope" doc:name="SOAP" />
</flow>
for compliance reasons I am not adding any specific details for WSDL and Endpoint. In above cxf:proxy-service wsdlLocation will be HTTPS instead of HTTP.
Configure the TLS parameters directly on your HTTPS connector configuration.
See: http://www.mulesoft.org/documentation/display/current/HTTPS+Transport+Reference#HTTPSTransportReference-HTTPSConnector
I have a IIS hosted service http://localhost/someProject/services/myservice.svc . Is it possible to somehow make say http://locahost:9705 point to it? How do I set this up? It seems to be pretty straightforward with a Windows Service hosted WCF service, but I cannot figure how to accomplish this when using .svc files and IIS. In the app.config of a Windows Service I just add a host node...
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9705"/>
</baseAddresses>
</host>
however when I do the same thing in an IIS hosted svc web.config
<host>
<baseAddresses>
<add baseAddress="http://localhost:9705"/>
</baseAddresses>
</host>
I browse to http://localhost:9705 and I get an IE error cannot display the webpage etc... In the windows hosted services I'm able to browse to the page, although not in this example as I'm using net.tcp, but with other services, it works. What am I doing wrong here? Is this even possible? Please point me in the right direction. Thanks for any tips and/or help.
Cheers,
~ck in San Diego
If you host in IIS, it's IIS that controls where the service is located. You cannot override the IIS settings - if your *.svc file is located under http://localhost/someproject/services/myservice.svc, then that's your service address. Any <baseAddress> settings in your web.config file are ignored and useless.
So either you can configure this in IIS, or you have to switch to self-hosting your WCF service in e.g. a Windows Service or a console app or something.
My WCF serice seems to be using the computer-name instead of the domain name. When I view the MyService.svc?wsdl link it is showing my computer name.
Where do I add my domain name in the web.config? Endpoint address, baseaddress or identity?
Note: I am using SSL so it has to be https://www.example.com/myservice.svc
WCF 4.0 has solved this issue in some instances with a new config option that use Request Headers:
<behaviors>
<serviceBehaviors>
<behavior name="AutoVaultUploadBehavior">
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="https" port="443" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
For IIS7 you don't add it to web.config, but to the IIS configuration file.
First off edit the bindings for your web site so the HTTP protocol specifies a host name if you haven't already - this will ensure it gets the correct name under HTTP.
Navigate to C:\Windows\System32\inetsrv\config and open applicationHost.config
Look for the sites section. You will see something like the following
<sites>
<site name="Default Web Site" id="1">
<application path="/">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:puck" />
<binding protocol="net.tcp" bindingInformation="808:*" />
<binding protocol="net.pipe" bindingInformation="*" />
<binding protocol="net.msmq" bindingInformation="localhost" />
<binding protocol="msmq.formatname" bindingInformation="localhost" />
<binding protocol="http" bindingInformation="*:80:puck.idunno.org" />
<binding protocol="http" bindingInformation="*:80:localhost" />
<binding protocol="https" bindingInformation="*:443:" />
</bindings>
</site>
....
</sites>
You can see that the bindings for the http protocol specify a host header, but https doesn't. When you're web browsing you can't use host headers over HTTPS, but WCF still uses it when generating the WSDL - if it can't find one it will fall back to the machine name.
So all you need to do is edit the HTTPS binding like so
<binding protocol="https" bindingInformation="*:443:puck" />
appending the correct FQDN to the end of the binding information. Reset IIS and WCF should get it right now.
The IIS6 solution has already been posted by darin
As stated in this link WCF is using the computer name instead of the IP address and cannot be resolved
It solved my problem, maybe because i have multiple web sites in the same host, and is very simple.
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
To fix this problem Configure the httpGetEnabled attribute and httpsGetEnabled attribute in web.config file
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
We're using WCFExtras to change the name of the host.
WCFExtras is a small open source library that will allow you to write the following to change the host name:
<behaviors>
<endpointBehaviors>
<behavior name="xxx">
<wsdlExtensions location="http://some-hostname-visible-from-outside/path-to-a-service/service.svc" singleFile="True" />
</behavior>
...
just adding
<useRequestHeadersForMetadataAddress></useRequestHeadersForMetadataAddress> to the solved my issue.
It seems that WCF 4.0 takes care of the Headers by adding this
I was using SSL for accessing the WCF Service.
I have added solutions here, http://knowledgebaseworld.blogspot.com/2010/06/domain-name-replaced-with-machine-name.html. it should work for you all as its working fine with me on local, staging and production without doing binding on iis
None of these solutions were helpful to me. I was able to solve this with a very simple custom Service Factory.
Installing a WCF Service on a Shared Hosting Site, Revisited
Have you tried setting the host header in IIS?
Although its an old posting, here is an answer.
Under Service Behaviour --> ServiceMetaData add service url.
Please note if you do not add myService, it will throw another error.
I had this very issue with my production server. I have found various articles on the multiple host headers with IIS and WCF issue, but if you are using SSL, you cannot add a host header to the website identities within the IIS UI, you can only add them to normal HTTP identities:
However you can add SSL host headers via a command prompt script, and this solved the issue for me:
cscript.exe adsutil.vbs set /w3svc/<site identifier>/SecureBindings ":443:<host header>"
For more information on this see this link: http://blumenthalit.net/blog/Lists/Posts/Post.aspx?ID=14
This post solved it for me. I needed to associate my domain name with my IP address and website in IIS.
http://www.codemeit.com/wcf/wcf-wsdl-xsdimport-schemalocations-link-to-local-machine-name-not-domain-name-while-hosted-in-iis.html
Thanks to Kanasz Robert.
Steps that solved my problem -
1.Produce the wsdl in the browser and save to file (by hitting .svc?wsdl from browser) save as .wsdl
Produce the xsd files by hitting url from wsdl (xsd=xsd0, etc), and save to file from browser, save as .wsdl
replace all machine name references from wsdl with domain name (or ip address) and change xsd references and save AND replace all machine name references from xsd files with domain name (or ip address)
make sure to name xsd file with .xsd extension (ie, name0.xsd, name1.xsd, name2.xsd)
copy wsdl and xsd file(s) to virtual directory
add to your web.config following lines:
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" externalMetadataLocation="http://IPorDomainName/MyServices/FileTransferService.wsdl" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>