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.
Related
I have created a web service application (hosted in IIS) using WCF. When I attempt to create a service reference on the client side, the address generated is the server name on the local network (e.g. server1.corporate.darkbond.com). I'd like the client WSDL to reference the actual published name (e.g. manager.darkbond.com). Is there any way to accomplish this on the server side using WSDL rather than editing the client configuration file after each update?
If you would like the address in the generated WSDL to match the address the client used to access the WSDL, for example via a load balancer host name, use a serviceBehavior with the useRequestHeadersForMetadataAddress added.
<serviceBehaviors>
<behavior name="myBehaviour">
<useRequestHeadersForMetadataAddress />
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
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>
Error Message:
[EndpointNotFoundException: There was no endpoint listening at "Link/MobileMotivation.asmx" that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.]
This is a MVC4 applcation, it works fine on the local machine. However when I implement it to the server which is the same server as the web service, it shows the error message.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MobileMotivationSoap" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://stuiis.cms.gre.ac.uk/bb116/FinalYear2/FinalYear2/MobileMotivation.asmx"
binding="basicHttpBinding" bindingConfiguration="MobileMotivationSoap"
contract="MobileMotivationService.MobileMotivationSoap" name="MobileMotivationSoap" />
</client>
You might need to edit the anonymous authentication settings.
Go to:
Server Manager
IIS
Connections > Sites > YourSite
Click Authentication > Enable
At this point you can select application pool identity.
More details here: A web site code can't connect to a soap service on the same server
I am trying to program a VisualWebPart using Visual Studio 2010 which has to do a simple thing: invoke a web service (hosted in a remote server, NOT locally). When I execute within the Sharepoint site (version 2010, which I have published in my IIS) I get this error:
"The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'."
Pardon my ignorance, but the only difference here is the case of the Ntlm authentication scheme! I have been all over the web and found many related problems, but none of the solutions worked. Almost ALL solutions i found involve modifications in the webservice security configuration, this is not an option for me.
Looking for a solution, I created a sample windows form and invoked the web service from it: no problems whatsoever.
In order to be able to invoke the webservice correctly this is the necessary security configuration:
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
I believe the problem is that I haven´t been able to properly set this security property to the web.config of my Sharepoint site, since I tried to put it in the security tag that appears in the web.config but still get the same error.
Any further information needed please ask, I am REALLY desperate, for days I have been with the SAME error.
In the end I was given permissions in their server: more precisely in the database which was the one that wouldn't let me create the web part in the server. Once this was done, the call to the webservice worked just fine, because they have the web.config correctly configured.
I have a webservice and a Silverlight application.
I also have a crossdomain.xml and clientaccesspolicy.xml
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
here my cross domain policy
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="http://localhost/MHVWS/MachineHistoryWS.asmx" />
</cross-domain-policy>
My web service is being hosted in IIS.
With this configuration I still have this kind of error:
An error occurred while trying to make a request to URI 'http://localhost/MHVWS/MachineHistoryWS.asmx'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
Please help
You only need one policy file. You dont require both.
Be sure one (or both) of those policy files exist in the same location (domain) as the webservice.
To debug and see what is going on, use a tool like Fiddler to verify the url path of the policy xml file the client is looking for.