I would like to try testing virtual hosting of an ASP.Net MVC website on my local machine. In Visual Studio in the Web tab of the properties file for the MVC project, I selected Use Local IIS Web Server. By "virtual hosting", what I really mean is that I'm trying to make sure that pages load correctly for urls of the form http://sub-domain-i.my-domain.com/MyMvcProject/Controller/Action, where I'm hoping to test multiple subdomains in place of sub-domain-i. In production, everything will be running under a single IP address on one server. I also hope to test https for urls of this form using a wildcard ssl certificate, but currently I'm having trouble configuring Visual Studio to just test regular http. Prior to worrying about sub-domains, the Project Url field in the Web tab of the properties folder for my MVC project said "http://localhost/MyMvcProject", and everything worked fine. However, after changing this to "http://sub-domain-1.my-domain.com/MyMvcProject" and then adding the following line into my C:\Windows\System32\drivers\etc\hosts file,
127.0.0.1 sub-domain-1.my-domain.com
Visual Studio produces the error "Unable to create the virtual directory. http://sub-domain-1.my-domain.com/MyMvcProject". Does anyone know what I might be doing wrong?
Many thanks in advance!
Edit: I've just discovered that if I select Use Custom Web Server instead of Use Local IIS Web server, it works and I don't get the popup error from Visual Studio. I'm still not sure why this solution works, though, or what I was doing wrong by selecting Use Custom Web Server...
A little late, but I hope it helps somebody.
You need to create the binding in the IIS website prior to add it to the project url of the project. That binding must be like
http | sub-domain-1.my-domain.com | 80 | * or 127.0.0.1
How to create a binding
Related
We currently a cookie based single sign on solution for multiple sites.
As far as I know to share cookie you have to use a subdomain instead of localhost. Otherwise the browser would ignore it.
However I get an error saying "you must specifiy localhost as your servername" when I try change the project url setting to my subdomain.
It only works if I manually add a entry in the applicationhosts.config.
Whats the eaSIEST way to write a script that will merge other develelopers config with mine?
Or even better is there a way around this limitation
Found a solution.
In visual studio 2013 the only way I can find is to keep the project url as localhost: then set the start url to yoursubdomain.domain.com.
To add site entry to iis express you can run the folllowing as per scott hanselman blog http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
"c:\Program Files (x86)\IIS Express\appcmd.exe" set site /site.name:MvcApplication18 /+bindings.[protocol='http',bindingInformation='*:80:hanselman-w500']
I have to test a Web Service with visual studio 2015, using IIS.
I have a project "MyWebService", this project contains a page "myPage.ashx". When I start the project my chrome explorer starts on page localhost - /. There I can see all file in the project.
But when I click on myPage.ashx I got an error 404 :
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.
I changed the property "browse to URL" to ~/myPage.ashx but there is no difference. I'm very new to web services and I need help to know where I have to looking for.
.ashx file extension might not be defined in your IIS.
See official documentation on Microsoft site How to: Configure an HTTP Handler Extension in IIS.
I used apidocjs to setup the documentation of my asp.net web api app. Everything works fine on my machine when I run my web api in visual studio but not on the server I deployed the app to.
I get a 404 error when I navigate to the index.html generated by apidocjs.
I think it's an issue with IIS.
I need suggestions on how to resolve this?
Ok. Found the problem kind of silly.
I did not include the ~ symbol as part of the path in my anchor tag.
Before I had
I added ~
<li>Docs</li>
<li>Docs</li>
and problem solved!!!
Update.
What I did earlier solved the problem on the deployment i did to my local IIS but not on my remote server.
I had move my static html file into the Content folder of my web-api, edited the link to look like this and the problem was resolved.
Docs
Got this from here. Ordinary html links in mvc razor
after updating my test project to beta8 (not without a huge pain), I finally managed to have my project up and running.
Now, every time I try to debug with IISExpress, I have explicitly point to the page "index.html" and this breaks my angularjs app.
There is a way to map index.html as default document in IIS Express?
I think you need to properly configure the middleware:
app.UseDefaultFiles();
It has some overrides if you need them. You can find more details here.
I have a web application which is working good on my local system. I have used Visual studio one-click publish method to deploy it to the server. The publish shows successful but when I try to browse the web site with http:\servername\application, it is giving me HTTP 404 web page not found error message.
Is it any type of setting in IIS that I am missing or please let me know how can I fix this and make the application run from the server.
Thanks.
Try giving the .aspx or .html page which ever you are using as default page..after the url you have given..and see if the problem is still there