I am using IIS to host an internal site. I have used visual studio express for web.
The problem I am having is when try to go to another part of the web site it drops the application name I have given it in IIS
Example:
www.name.com/applicationName/Home (this is whats working)
after trying to move to another part of the site the url becomes
www.name.com/Home/showDevice?sendmsg=192.168.0.1 (This does not work)
if I add the /applicationName/ to the above url it works correctly.
Is this and IIS issue I need to configure or is there something in the code I need to fix.
Related
We have a public website that is already exposed to the outside, although in reality there's really nothing there. Simply default.htm file with "Coming Soon" text in it. (http://vensuresoftware.com/)
We also have a WebAPI we've put together that we want to add to this website. When I publish locally to my IIS6, it works no problem. It's accessed as http://localhost/HRConnect/api/Claims just fine. I've used PostMan, a C# client, and Javascript AJAX to access this just fine. I can also load it in a browser at that URL, and I get the appropriate default controller and action.
However, I have been totally unable to accomplish this same thing on the website. Ideally I'd like to include it as a Virtual Directory to the http://vensuresoftware.com and access it as http://vensuresoftware.com/HRConnect/api/Claims but I've had zero luck doing so.
I have tried to add it as a Virtual Directory as well as an Application under that specific website, but when I access the URL, all I get is "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
I've ensure the Application pool is correct, with an appropriate user and the pass through connection test succeeds. But I just cannot access the service or the URL.
Any ideas or suggestions at all on what I can try? I'm not sure what else I can include here. Nothing special in IIS, nothing special in the service really. There's only 3 actions in it. As I said, it all works beautifully locally, under localhost though.
IIS 7 doesn't have built-in support for extensionless URLs which causes a lot of headaches trying to get MVC and Web API apps to run. I've gotten it to work using both these options. Pick the one that applies to you.
Install this IIS patch which allows IIS 7 to handle extensionless URLs.
If the patch isn't an option because you're worried about breaking other sites on the server, you can make the Web.config adjustment found in this answer. You'll have to do this for every MVC/Web API app you have running on the server.
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.
I have a IIS running on my webserver. I developed a rest api based on a mvc 4 web api. the problem i have at the moment is that when I put new / changed files onto the IIS that the IIS is not "recognizing" them.
lets say for example i changed one service - put the new file on the server - server thinks he still has the old file. I observer this behaviour because when i call the service i still get the old result - not the new result as implemented in visual studio locally. I have no clue why the IIS is acting like that...
As leppie already mentioned in the comments, I had a wrong understanding of ASP.NET web sites and ASP.NET web applications.
As a solution, I had to do a rebuild to compile the DLL again and then deploy it to the IIS.
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.