WCF and IIS confusion on the wsdl location - wcf

I created my WCF project and it works fine when I just run it from the debugger.
But when I publish it to IIS and point a browser to the svc the path used has localhost in it. Like this:
htpp://localhost/MyService/MyServices.svc
but the path that the webpage says to go to for the WSDL uses my computer name, like this:
http://MyComputerName.MyDomain.net/MyService/MyService.svc?wsdl
When I click on the link it times out. (Also, trying to view the services like that in WCFTestClient times out.)
However, if I go the wsdl using localhost then it works right away:
http://lcoalhost/MyService/MyService.svc?wsdl
Any link that uses my computer name times out ("takes too long to respond").
Any idea on how to make my WCF service work with the computer name?
(NOTE: I am using Visual Studio Ultimate and IIS 7)

Try adding MyComputerName.MyDomain.net to your proxy bypass list in Internet Explorer proxy configuration setting. Check that the IIS website has this FQDN in it's hostname in the site bindings.
Also what happens if you only use MyComputerName without the domain ?

Related

Publish a WCFService doesn't work; Debugging-mode works

I want to start an default webservice-project, where I can send data over a service. When I go to debug the API through VS then everything works fine, but not when I try to use it over IIS.
I created an WcfServiceLibrary-Project in Visual Studio 2017. I then right-clicked on the project (in the solution explorer) and then published it to a folder A.
I also didn't do anything special at IIS (all the things are still on localhost.): I activated the default windows-feature "IIS". (The default web site got also stopped). Then I added there a site with an random name and the path to the folder A. The service got started.
My access trial was to find anything through Visual Studios "connected services".
Has anyone an idea?
At first, please use the WCF service application project template,
or the Appconfig file would not be kicked in. library project needs the additional configuration in the hosting environment, and the Appconfig file could not recognized. We have to move the configuration code into the configuration file recognized by your hosting environment.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/deploying-a-wcf-library-project
Secondly, for hosting the WCF service in IIS, we should enable the below windows feature.
Feel free to let me know if the problem still exists.

Cannot fetch wcf service remotely

i have 2 systems, one is localhost(Windows 8.1Pro) and another is Virtual Machine(Windows server 2008R2).
i have a silverlight app hosted in VM which is consuming WCF service from localhost installed in windows service.
Problem:
silverlight is not getting clientaccesspolicy.xml and crossdomain.xml so wcf service will not fetched.
Tried solutions:
Added clientaccesspolicy.xml and crossdomain.xml in WCF service solution before installing but still it can't be fetched from WCFservice url.
Added clientaccesspolicy.xml and crossdomain.xml in C:\inetpub\wwwroot folder, as per my search so many suggested to place their which will be automatically fetched by silverlight.
tried adding clientaccesspolicy.xml code into wcf service as per this link still no success.
Any suggestions will be appreciated.
Edit:
okay i am attaching code FYR, i am doing this as below.
once i build WCFTest , 'll get .exe wcf installer which i am installing that using installutil.exe, so service'll be up and running in services.msc.
once i build TestSL, 'll get TestSLTestPage.html , on double clicking on this it'll open in IE, and on button click i should get "Hello World" from WCF.
Download it from here and suggest me if i am doing anything wrong. Attached projects are of exact same structure as i am workinig on....
Regards,
Jithendra
as i explained my prob.above i was using self hosted Wcf service and i couldn't solve the problem so Here's what i did
1. Created Default WCF Service application in VS2013 with all my code and added clientaccesspolicy.xml and crossdomain.xml in the solution.
2. Created a new website in IIS Manager to publish my project.
3. and published my project to IIS as filesystem.
4. There we'll have all the files that are necessary.
And Voila everything works perfect.
Hope it helps somebody.

svc doesn't work

I have some problem and trying to solve for a few days..
I installed iis 6.0 but I updated it 7.5 express and 7.0. it looks 7.5 version..
so, I published wcf to localhost and set 4501 port. I can see file when I run iis http://localhost:4501/
but svc file doesnt work. When I click or type http://localhost:4501/Products.svc it doesnt work and I see a blank website.. nothing..
But If I run svc client in visual studio, asp.net development server works and my svc file works.. (http://localhost:4501/Products.svc) everything is same..
I dont understand why IIS doesnt work well?
I think that 6.0 doesnt support .. I use a proxy and I can connect to my global ip with proxy or my friend opens it.. but still svc file doesnt work..
I think the problem is iis.. but a global side, asp.net development server doesnt work too, but it works on localhost..
I opened all ports, add some new rule to firewall and i closed firewall (modem and computer)
I really become a crazy..
Edit: I try to connect ip with http://myGlobaLIp:4501 I can see my files on my localhost but If I try http://myGlobalIp:4501/Products.svc I get blank page..
Here is your issue: when you run from Visual Studio it automatically runs a virtual IIS for you, and assigns the ip/port...in this case it's http://localhost:4501/. When you setup the site and run it in IIS, you have to set those values during the website setup.
You need to create a website in IIS, then point to your code (publish it to a location like c:\inetpub\wwwroot\myapp)
You then need to set which port your webservice should run on.
THEN, go to http://{your ip or machine name}:{port configured in IIS, not the VS virtual IIS port}/Products.svc
Here is a step-by-step walk through from Microsoft to help you deploy a website (or wcf webservice): http://technet.microsoft.com/en-US/library/f6c26eb7-ad7e-4fe2-9239-9f5aa4ff44ce.aspx
good luck

WCF wsdualhttpbinding strange behaviour at client side that has no clear (Exception details)

to make long story as short as possible, I made a duplex WCF service, using wsdualhttpbinding, tested it on my local machine using Visual Stuido and using IIS7, thigs are working fine (i had to use windows authentication on IIS7 to make it work thu). Any way, I published the duplex service on my company network (LAN network, windows domain, IIS 6) which i used to for many WCF services (basic and ws http bindings and worked fine) and the problem is I can not get the service to work, I tried all possible configurations to the app.config and to the web.config files, still i can not make it work.. The problem is when the client start calling the duplex service It hangs and no error message or whatsoever, and after few minutes it gives me a timeout error.. there is no error at server side ( i have checked the even viewer). There is not error about port 80 or access privileges. Is there anything i am missing? anything i should take care of and i forgot? i have been awake for 20 hours trying to find a solution because i have a time line to follow or my boss will Dispose() Me..
i have tried the following:
1- I set the IsOneWay = true..
2- I run the program as admin.
3- I i set the base address to another port.. same result..
4- I used windows auth, none... same result..
5- i have tried another machine to test the client.. same result.. it hangs with no reponse.
6- I also tried running the client on windows vista, 7 and xp... same result..
7- I have played with all kind of configurations in config files and i made sure its the same on both files (app.config and web.config)..
8- I have added a static constructor in the service side to see if the service was ever reached by the client, i added few lines to add a value in the db.. and nothing was written to db.. so it was never reached..
9- Yes, when i access the service SVC page i see the page and it worked fine.. I could access the metadata as well..
10- restarting the server, restarting IIS server, Recycling AppPool...etc..
I tried all of that and many other solutions and tricks.. same result when the app is on IIS.. the strange thing is, there is no error at server side.. and i only get TimeOut error (if i get it).. While If i tried the service on the IIS installed locally it works fine.. change the config file to point to the company IIS server,,, no luck!
Is there anything i am missing??? could be something simple but i just missed it..

Deploy WCF REST 4.0 to XP IIS 5?

I am trying to deploy a simple "Hello World" .NET 4.0 REST-style WCF service on WinXP (IIS5). It works fine in Cassini.
I tried to adapt the info here to me:
http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
but something is not clicking. Can anyone lend ideas or comments? Yes, I must stay with WinXP.
Thanks.
After a fair amount of struggling I was able to successfully deploy a WCF 4.0 REST web service on XP/IIS5. For the benefit of you and others in the same situation, here's what I did (let me know if you need more detail):
Using VS 2010, build a deployment
package for the project and then
install it on the target machine
(your web server). The following
link will show you how to do this: http://vishaljoshi.blogspot.com/2009/03/web-packaging-installing-web-packages.html
Make sure that your virtual directory in IIS is configured to use .NET 4 (right click on virtual directory > properties > ASP.NET tab > ASP.NET Version)
Configure your virtual directory to support extensionless requests (i.e. your REST API) by creating a wildcard mapping (right click on virtual directory > properties > configuration > mappings tab) with the following properties:
Executable: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
Extension: .*
Check that file exists: unchecked
(Note: watch out for the bug that keeps the "OK" button on this dialog grayed out. To get around this just click in the executable textbox after entering your extension and the "OK" button should get enabled).
If you get an authentication error when accessing the service then turn off integrated authentication on the virtual directory. This should fix the problem if you have used the defaults in the generated web.config of your service. If you have explicitly modified the authentication mode then you will have to adapt accordingly.
Have you considered self-hosting your service instead of trying to use IIS. That will probably be easier to do than use IIS.
In case above steps dont work. There could be a problem with permissions on your App pool for that website / virtual directory , you can try to set that right and try it out.
You can refer this article for more help on this.
http://technicalwizardry.blogspot.in/2013/04/wcf-rest-service-hosted-on-iis-5.html#!/2013/04/wcf-rest-service-hosted-on-iis-5.html