I have created a WCF Service and it's running just fine. I have the link that takes you to the Manager Service page in order for someone to get the URL for this service.
I have added a controller/cshtml page in order to test (ping) the databases that are used by the service so that we can check if they're up and running (the databases that is).
When I run the service locally with IIS Express, it works just fine.
www.domanin.com/ServiceName/Manager.svc is the URL.
When I run locally this ping (cshtml), it's localhost:XXXXX/Status.
Status is the name of the controller. And this works! (when I run locally).
Why does it not work when I publish it to a Server?
I try to go to www.domain.com/ServiceName/Status and I get a page cannot be found. I've also tried www.domain.com/Status and nothing. Can you not have a razor (cshtml + controller) hosted together with a service?
Thanks!
It sounds like your routing is not configured correctly most likely your mixing your wcf and mvc configurations and somehow it got messy. If you add .cshtml as an iis mime type on that remote server I suppose you could see a response.
I suggest that you create a folder under the root and make another iis application and place the test app and configuration in its own location if that is possible. You can still share code that way but will not have the overhead of opening the mvc pipeline for requests to your wcf service.
Related
I have a large Web API project that runs my company's e-commerce site. I just noticed that any request to the web API shows the URI-stem as root in the IIS logs. Is there a way to see the full route to the API end point that was called?
I am trying to use File Beats in our Elastic Search/Log Stash/Kibana (ELK) setup. We got the File Beat setup to monitor the IIS log today and just showing the root does not give us the information that we are looking for in our logging.
Activate the Host(cs-host) field in the IIS managament console logging window. You can also try to add the HTTP_URL custom server variable:
I have a web service on a virtual development machine. This - as you would expect - works fine and all of my web methods are called and return as expected. Now I wish to call this web service from my base machine but I'm not sure of how to go about doing this.
What is the correct procedure to carry out the above?
you need to deploy the web services on IIS, you can do it in multiple ways one by using publishing utility
I have an azure cloud service with a couple worker roles, a WCF web role and a normal web role containing a couple aspx pages. Both roles are set to use https endpoints.
When testing locally in Visual studio using IIS the default.aspx page and the servicename.svc page both open in the browser. When I publish to azure though, the URL with the random string of characters opens the directory containing the service definition, but I can’t access the default.aspx page from that URL.
For example if my URL is randomstring.cloudapp.net after publishing, randomstring.cloudapp.net/wcfservice.svc works, but randomstring.cloudapp.net/default.aspx does not. I can get to the other page by using the IP address given in azure, but this isn’t really what I need. Furthermore, the cloud service URL does not work at all. mycloudservice.cloudapp.net results in webpage not found.
Do I need to do something special in order to get both the service, and the aspx pages to show up under mycloudservice.cloudapp.net? I can post the config files if need be, but as of right now, I don't think there relevant to the problem.
EDIT:
Just to clarify, I have now published to production, and the service is working [mycloudservice].cloudapp.net/[mywcfservice] and I can get to the website without a 404 error if I enter the port like [mycloudservice].cloudapp.net:8081/default.aspx . Is there a way to make everything show up under [mycloudservice].cloudapp.net/ without entering the port number so I can just type in [mycloudservice].cloudapp.net/[mywcfservice] AND [mycloudservice].cloudapp.net/default.aspx into the browser?
First, I guess you published your project to the stage slot of your cloud service. It's [Deployment ID].cloudapp.net. You will use the URL you specified if you deploy it to production slot.
Ref the problem, that '[randomstring].cloudapp.net/default.aspx' doesn't work, I'm not sure what you mean by 'doesn't work'. Is it 404 erroe? Or some asp.net runtime error. More information might be helpful.
Check the port numbers. Each of the endpoints (the wcf endpoint and the web endpoint) need to be on different port numbers. You'll need to access them as such when published to Azure.
The random-name issue is from publishing to Staging vs Production, as #Shaun pointed out.
I have an ASP.net web application that has different functionality and data depending on the URL that it is logged in as.
Everything works fine in a deployed environment as I can bind several hosts in IIS and the web application can then interrogate the request.URL to work out which code and data to use.
eg. http://foo.bar.com will run different code than http://test.bar.com
The problem arises in debugging in VS2010 on my development machine.
I can hard code a default site url in the configuration but require several to be run at the same time.
e.g site1.localhost, site2.localhost, site3.localhost ....
I have tried editing my hosts file in system32/drivers/etc
e.g
127.0.0.1 localhost site1.localhost site2.localhost
but if I hit site1.localhost in my code the request.Url is always localhost
Is there anyway I can get around this?
If you have mapped your host name in system32/drivers/etc/hosts, try this code. This should return the correct path
string host = Request.Headers["Host"];
string pathAndQuery = Request.Url.PathAndQuery;
string fullPath = host + pathAndQuery;
Based on mfras3r comments. I can get it to work via
Setting up a website in IIS, point that web site to the directory of my MVC application.
Add the bindings for all the urls to the website in IIS.
Add the urls as entries in /etc/hosts pointing to localhost.
Build the application. ( Don't run it as it will screw up due to IIS)
Debug -> Attach to IIS process.
I think the debug server in vs2010 is not a full featured IIS. It do not support multiple site. So in your situation, it is better to use "attach" or remote debug. It is depends on whether you can install IIS on your development machine.
Duplicate: This is the exact same question, from the exact same person, as Issue with Incorrect URLs in the WSDL of a .NET Web Service, and has the exact same answer. Let's please close this and merge it with the other.
We have installed an ASP.NET web site on a client's server. This site has a web service with a couple of web methods that are called by a Flash object in order to display a news feed. If you browse to their site (ex: www.domain.com), everything's working fine except the flash.
The issue is that when we browse to the .asmx, the header shows that the Host is a subdomain internal to their network (internal.domain.com). Obviously this doesn't resolve to any public IP when browsing from outside of their network. This causes the Flash to fail since the flash object is embedded on a page and is therefore running client side.
I checked the computer name on the server in question, and it doesn't even match "internal.domain.com" - it is something completely different. Where is it getting this information from. It is not coming from IIS, since we have no host headers set up, and the IP for the site is set to (all unassigned).
We either need to force the web service to run against a specific host, or we need to change something on the server so that it resolves to a valid public-facing host name. Any and all help is greatly appreciated!!!!
Web service host names are usually configured in the web.config when being consumed by .NET. When they are being consumed by flash you might need to go looking in the flash file. (my guess is that it is still configured for some sort of SIT environment.
I'm not sure of the details of this, but I've seen this complaint with respect to WCF. The answer had to do with setting the host headers in IIS.
It's IIS that passes the host name to ASP.NET or WCF, and it passes the host header when that is configured. If it's not configured, then I suppose it won't send that header as the "host name", even if the client sets that header in the request.