Publish sites at custom portnumbers in windows azure? - asp.net

We are trying to publish three sites in Azure, they are on ports 8080-8082.
The site on 8080 works fine, the sites on 8081 and 8082 does however not respond from the outside.
Ideas?

This is on a single role, right? Can you put your ServiceDefinition up to look at? Typically this is because you miconfigured input endpoints or the binding. Here is a trivial example that has 3 sites on 3 different ports.
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="WindowsAzureProject1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="MvcWebRole1">
<Sites>
<Site name="Web1" physicalDirectory="../pathtowebsite1">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
<Site name="Web2" physicalDirectory="../pathtowebsite2">
<Bindings>
<Binding name="Endpoint2" endpointName="Endpoint2" />
</Bindings>
</Site>
<Site name="Web2" physicalDirectory="../pathtowebsite3">
<Bindings>
<Binding name="Endpoint3" endpointName="Endpoint3" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="8080" />
<InputEndpoint name="Endpoint2" protocol="http" port="8081" />
<InputEndpoint name="Endpoint3" protocol="http" port="8082" />
</Endpoints>
</WebRole>
</ServiceDefinition>

Related

How to support multiple domain name for the same project in Visual Studio 2019 and asp.net core app?

I have a project that is written on the top of Asp.NET 5/Core using Visual Studio 2019.
My project has multi-tenancy support and need to be able to map multiple local domains to the project to test out multi-tenancy.
How can I bind a second local domain to point to the same running host? I added tenant1.website and tenant2.website in the .hosts file like so
127.0.0.1 tenant1.website
127.0.0.1 tenant2.website
I tried to modify the .vs\PrjectName\config\applicationhost.config and added new binding like this
<site name="ProjectName.Web" id="2">
<application path="/" applicationPool="ProjectName.Web AppPool">
<virtualDirectory path="/" physicalPath="E:\ProjectName\ProjectName.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:37893:localhost" />
<binding protocol="https" bindingInformation="*:44356:localhost" />
<binding protocol="http" bindingInformation="*:37893:tenant1.website" />
<binding protocol="https" bindingInformation="*:44356:tenant1.website" />
<binding protocol="http" bindingInformation="*:37893:tenant2.website" />
<binding protocol="https" bindingInformation="*:44356:tenant2.website" />
</bindings>
</site>
But, when I go to https://tenant1.website:44356 I get the following error
This site can’t be reached
How can I correctly bind tenant1.website and tenant2.website to my locally running app using IIS Express?

Visual Studio localhost IIS Server Not Found

I'm trying to run an ASP.NET webforms website that I downloaded from an FTP server, but I'm running into problems when I try to build and run the project.
When I build and run the website, it opens my browser window, but adds "www." before the localhost address and I get a server not found error. I'm able to successfully build and run other websites, so I think I must have something wrong in the web.config or website properties. Here's a screenshot of my browser window:
Visual Studio Version: 15.7.2
IS Express: 10.0.1743
I tried changing the IIS port being used in the application.config file to see if that helped, but it gets replaced by a new site tag after I edit the original one. For example if my original port is 51060 and I change it to 51065 like this:
<sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
<site name="mywebsite" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\me\Documents\mywebsite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:51065:localhost" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
The application.config file changes to:
<sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
<site name="mywebsite" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\me\Documents\mywebsite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:51065:localhost" />
</bindings>
</site>
<site name="mywebsite(1)" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\me\Documents\mywebsite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:51060:localhost" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
Thanks for any help.
Right click on your web forms application project and then properties, navigate to the Web section, then look at the Servers section, and look at the Project Url that is being used, you can also mark the option Override application root URL if needed.
I hope it helps.

Why is my front-end not retrieving information from my back-end?

If I run my application locally (using localhost) it works perfectly.
But when I decided to switch to my global ip address (when I say global I mean not my lan ip address, but the one given by my ISP).
It just doesn't load the data from my back-end.
This is how I make the requests from my front-end:
this.http.get("http://my-isp-ip:52899/api/Student/ListStudents").subscribe(response => {
this.users = response["Users"];
});
And this is how I got my applicationhost.config on my back-end:
<bindings>
<binding protocol="http" bindingInformation="*:52899:localhost" />
<binding protocol="http" bindingInformation="*:52899:my-isp-ip" />
</bindings>
And I run the front-end application like this:
ng serve --host 0.0.0.0
And I already opened the ports both in my router and my firewall.
Now, in my router I only opened the ports: 4200 since this is the one running on my front-end and 52889 which is the one running on my back-end.
What can I be doing wrong?
Solution:
I changed:
<bindings>
<binding protocol="http" bindingInformation="*:52899:localhost" />
<binding protocol="http" bindingInformation="*:52899:my-isp-ip" />
</bindings>
To:
<bindings>
<binding protocol="http" bindingInformation="*:52899:localhost" />
<binding protocol="http" bindingInformation="*:52899:*" />
</bindings>
And run Visual Studio as Administrator...

Namespaces for WCF Web.config, client and server side, maxReceivedMessageSize

I'm not a VB developer and I'm having some issues with Namespace for a Web service. I own both the client and server side of this so I have no issues changing settings.
I'm trying to connect to a webservice and while doing so I get a MaxReceivedMessageSize exception.
They way I go about this is that I have a solution with a "web project" and more "class projects", in one of my "class projects" I have a Service reference and a app.config file where I do my settings.
I have read that I need to have app.config settings in my application and add settings on server web.config for the web service. I'm confused about the namespaces I need to set in the web.config for the web.service on server side. Can anybody help me out a bit? I use this settings
(server)
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="Erp_QueryServiceSoap" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WebService.Erp_QueryService.Erp_QueryServiceSoap">
<endpoint address="Erp_QueryService.Erp_QueryServiceSoap"
binding="wsHttpBinding" bindingConfiguration="Erp_QueryServiceSoap"
contract="Erp_QueryService.Erp_QueryServiceSoap" name="Erp_QueryServiceSoap" />
</service>
</services>
</system.serviceModel>
(client)
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="Erp_QueryServiceSoap" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="CONNECTION TO SERVICE"
binding="wsHttpBinding" bindingConfiguration="Erp_QueryServiceSoap"
contract="ServiceQuery.Erp_QueryServiceSoap" name="Erp_QueryServiceSoap" />
</client>
</system.serviceModel>
i think may be problem is not with namespaces.
try to set maxItemsInObjectGraph to the following.
in behaviour section
<behavior name="YourServiceNameBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
**<dataContractSerializer maxItemsInObjectGraph="2147483647" />**
</behavior>
i think you already have added those codes except
**<dataContractSerializer maxItemsInObjectGraph="2147483647" />**
try adding this code line.

IIS Express keeps creating website copies

I'm developing a Web API using VS2012. In order to allow my mates access the api in the same LAN, I need to modify the applicationhost.config file.
The problem is that sometimes when I modify the code and start debugging, I found that IIS Express created a copy of my application, say MyWebAPI(1), MyWebAPI(2)... Then I have to modify the applicationhost.config again.
Does anyone know in which case IIS Express will create a copy of my application?
Here is an example of what my applicationhost.config:
<site name="MyWebAPI(1)" id="15">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Example\example" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:8080:*" />
</bindings>
</site>
<site name="SunPower(2)" id="16">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Example\example" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:8080:*" />
</bindings>
</site>

Resources