Using TCP port other than Default 42424 for asp state server - asp.net

I am using ASP state server for session management in my asp website. In one of my server I have two asp website. For one website i used tcpip=loopback:42424 and it works. For another website i wanted to use some other ports. I tried different ports in the range 30000 to 50000 and it does not work and get error like
Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name
But in my case asp state server is uses port of local machine only. So now how can i configure asp website to use different port for asp state server?

Related

azure connect between azure myWebRole and nonazure server not working

My webapplication hosted on windows azure, needs to communicate with TFS Server. When any one login to my web app using live id, I want the logged in user to use my Team foundation server(TFS) credentials -username,password and domain to programatically authenticate and connect to our TFS server and create some work items.
I configured my azure connect for the communication to happen between azure WebRole and TFS server (our TFS is non-azure ).I added both the WebRole and the TFS Server into single Connection Group
In my azureportal ,I can see mywebrole and my TFSServer as connected the machine endpoint is active, and that it refreshes since the last connected updates
.But when I try to run my web application from azure and when it tries to communicate with our TFS server ,its throwing error message saying Error message : Team Foundation services are not available from server eg.,http://xyz-abcxyx-01:8080/tfs/eas/. Technical information (for administrator): The remote name could not be resolved: 'xyz-abcxyx-01'
Any suggestions to resolve this issue ?
You should enable remote desktop on your WebRole and connect to one of your instances. Then, try to ping the IP of your TFS server (not the hostname xyz-abcxyx-01). Maybe this is simply a DNS issue (even though using hostnames works with Windows Azure Connect).
If pinging the IP works, but pinging the hostname doesn't work you have a few options left:
Use the IP instead of the hostname. This won't work if you configured your TFS to use host headers.
Create an elevated startup task to modify the hosts file and map the IP to the hostname. In your code you can keep working with the hostname.
Try to modify the DNS server configured in your WebRole to use the default DNS server + your internal DNS server. But to me this doesn't look like a clean solution.
Anyways, in each solution you'll want to store the IP/hostname in the ServiceConfiguration and make sure your code supports changes to the ServiceConfiguration. This will allow you to change the IP/hostname without having to redeploy.
You should check if TFS server is listening on all network interfaces, include the one created by Azure Connect (start with 2a01). Next try to connect to TFS from a machine on the local LAN, just to make sure it is configured correctly. You don't need to use IP for referring to TFS, DNS name is definitely supported out of box.

Simulate SSL termination with IIS Express

In our production environment a website runs under HTTPS with SSL terminating on a load balancer and passing traffic to the IIS servers as HTTP.
There are various in-house and 3rd party components and controls within the site and some of them use mechanisms similar to the .NET System.Web.HttpRequest.IsSecureConnection property which simply queries the HTTPS server variable to return its result. As the connection into the web server from the load balancer is HTTP, these methods return the incorrect value and cause some components to fail. For example, a component might direct the user to a HTTP URL instead of HTTPS for a JavaScript file and cause the browser not to load the mixed content.
In order to debug these components and to develop a workaround, I need to recreate this scenario on my development machine. My question is Is there an easy way to simulate an externally terminated SSL connection for the Visual Studio / IIS Express development environment?
I've found a way using Port Forwarding Wizard.
Create a single TCP mapping with Listen Port set to a spare port (e.g. 443), destination as localhost with web server port (e.g. 80). Leave everything else as default, but go into SSL Encryption and generate a Root Key and Certificate in CA Center. Once done, select Enable SSL Encryption and select Server. Generate a Private Key file, Cert Req file and a Certificate and then bob's your uncle, you get terminated SSL forwarding to your local IIS Express server: Simply Start your port mapping and then connect to https://localhost with your web browser (specifying the port if it's not 443).

Connection to SQL server 2000 on a windows server 2003 domain controller

I am trying to connect an ASP.NET 2.0 application hosted on a client machine to an SQL server 2000 instance which is installed on a domain controller running windows server 2003 (I appreciate this is not best practise, but it is something I cannot change). I am using SQL server authentication, not Windows authentication.
During debugging, the following error is displayed at the point the 'connection' is attempted within the web application (not on running any object within Sql Server):
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
I have done some research, and have checked a variety of things:
1) I am certain the conection string is correct - in fact I built a little Windows app that uses the same connection information and connection succeeds...
2) This is limited to the web application - a windows application running on the remote client machine connects just fine using the same connection string (see 1).
3) The firewall settings on both computers do not prevent the connection (see 1).
4) I can ping the windows 2003 server (see 1)
5) The SQL Server credentials definitely have the rights to the objects needed
6) If I (temporarily) put the web application on the windows server 2003 and run it, it loads and runs fine (using a browser on a separate machine, or on the client machine I am trying to connect) - suggesting this is only an issue with a remote connection, and confirming the connectivity between the machines again, and also confirming the necessary security right of the SQL Server user.
7) I can start query analyser on the client machine and using the same SQL server credentials, can run the same queries on the target database just fine.
Stumped. Please help!
You need to go into the SQL Server Configuration Manager and make sure the Named Pipes option is turned on. It is not turned on by default when you install SQL Server.
Because of the research I did in the original question covering the ability of a windows app to connect but not the ASP.NET app to connect from the same machine, and the confirmation the web app was working on the server itself, I was convinced SQL server was set up correctly, that connectivity and firewalls were not a problem - it must have been a difference in the security credentials of the windows app versus the web app.
The windows app runs in the security credentials of the logged on windows user and authenticates using that, whereas the webapp runs in a restricted account and does not pass these credentials over when connecting to SQL server by default. I simply added to web.config, which impersonates the user account within which the web app runs, and it all worked!
Problem solved.

ASP.Net State Server Fault Tolerance

Can a State server in ASP.Net be made fault tolerant? By that I mean is when one state server goes down, ASP.Net applications can switch to another state server.
I do not want to go to a Database based state management as that seems considerably slower than the State Server.
You need to configure two different servers in fail over cluster i.e. if one server goes down due to some issue, other server will get up. For details see:-
http://technet.microsoft.com/en-us/library/cc731844%28WS.10%29.aspx
When you configure your servers in fail over mode then a virtual IP is given to you which you will use as your state server's IP.
Also have a look at peer to peer state server as well:-
http://www.codeproject.com/KB/aspnet/p2pstateserver.aspx

Sql Server 2005 only accessible in ASP.NET 1.1 when I specify protocol and port

My company is currently migrating some of their really old db's to sql server 2005. Some legacy apps have problems connecting to the new server. The connection string works in Asp.NET 2.0, probably because it assumes tcp:1433 automatically.
I have to construct the connection string like this in ASP.NET 1.1 for it to work:
"Server=tcp:my.server.com,1433;..."
Without the protocol and the port, the connection fails ("Invalid Connection exception")
TCP 1433 and UDP 1434 are open on our firewall. On SQL Server 2005 Remote Access is enabled, so is TCPIP, the SQL Browser service is running, I use the proper login credentials.
Any ideas why I can't just specify the server name without protocol and port number?
IIRC SQL Server 2005 defaults to find any-old-port that is available. On my laptop this means port 1212.
To force it to a specific port you must go to Start->Programs->SQL Server 2005->Configuration Tools->SQL Server Configuration Manager
From here you must go to SQL Server 2005 Network Configuration->Protocols for (name of service)->Right click on TCP/IP->Properties->Choose tab "IP Address" and set TCP Dynamic Ports to .
For some reason "0" means "Yes, use dynamic ports" and (i.e. no entry in field) menas "No, I will specify it myself"
Then fill in the field TCP Port with 1433.
Do so on all adapters that are listed, and restart the SQL Service.
You can now check if the service is indeed on the right port by doing the following
Start->Run->cmd.exe
C:>netstat -ano
look for an entry like this
local address <stuff> PID
0.0.0.0:1433 <some number>
Now do
C:>tasklist
and look for the task with the number from above. This task should be called something like sqlsrvr.exe.
Perhaps your SQL Server is configured for multi-protocol, and it's trying to use the other protocol first and failing, perhaps for some security reason (the account that the app is running as in IIS). Just a guess.
Check the "SQL Native Client Configuration" settings in "SQL Configuration Manager" on the ASP.NET machine. The default connection settings are set there. Also try messing with the MDAC configuration:
http://msdn.microsoft.com/en-us/library/ms131035.aspx

Resources