I've got a weird problem with Azure Mobile Services hosted on IIS Express. I searched around SO and the web, but I did not find anything that works for my problem, so here it is:
When I create a new Azure Mobile Service project in Visual Studio (VS 2013 Upd. 4, Azure Tools 2.2, Admin mode), then all seems to be fine at first sight, and I can interact with it as expected through the test webpage that pops up after (Ctrl+) F5.
However, when I try to call the service programmatically from a client, e.g. like in this test
[TestFixture]
public class Fixture
{
private static readonly MobileServiceClient ServiceClient =
new MobileServiceClient("http://localhost:64481/");
[Test]
public async void Test()
{
IMobileServiceTable<TodoItem> table = ServiceClient.GetTable<TodoItem>();
List<TodoItem> items = await table.ToListAsync();
Assert.That(items.Count, Is.EqualTo(2));
}
}
... then I (most of the time) cannot access the service, and I get this exception:
System.Net.Http.HttpRequestException : An error occurred while sending the request.
----> System.Net.WebException : Unable to connect to the remote server
----> System.Net.Sockets.SocketException : A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond [::1]:64481
The weird thing is that the above test occasionally succeeds, but most of the time fails with this exception. I cannot find any regularity behind this. It seems like there's a bigger chance for it to succeed if IISExpress was freshly started and the test webpage is open, but that's not a strict rule.
So far, I have monitored the iisexpress.exe process with ProcessMonitor and executed the command line manually from the console (Admin mode). When I do that, again the test page is working as expected and I can see the requests coming through at the console. I can also see that in the error scenario no request is reaching the web server. So obviously it gets blocked by something in the chain that comes beforehand.
Remark: The error also occurs without any firewall running.
I'm totally stuck on this, having no idea what the problem could be, not even what else I could do to find out what's going on. Any help on this is appreciated.
Related
I am working on a web api backend.
I am trying to make a call to another web api from within one of our api controllers.
When I run this as a unit test it works fine.
However, when it is hosted on IIS Express the GetAsync call fails with the exception: "No connection could be made because the target machine actively refused it 127.0.0.1:8888".
When we host it on azure we also get a similar exception.
Is there a setting in our web.config missing?
Any suggestions?
looks like it is still pointing to local host, needs to point to IIS or Azure server.
Check for hardcoded values in test code or web config.
I have written a fairly simple chat application in SignalR.
It seems if i connect with more than 2 tabs/browsers/devices the third will hang and never connect and eventually cause problems.
Why can I only connect with 2 users?
The third request goes through as soon as I disconnect one of the other 2.
Doesn't matter if I use the same user or different users.
I am using IIS on Windows 10, Asp.Net MVC5 with SignalR 2.2
It never calls the hub code, if I try to connect with a fourth client while that tab is open the fourth tab won't even return the view.
$.connection.hub.start().done(function () {
//add all existing messages when we start the connection
//chat.server.addExistingMessages();
console.log('Now connected, connection ID=' + $.connection.hub.id);
console.log is never hit for the third connection.
$.connection.hub.start()
Is hit, and the connection and hub have values that aren't null.
public override Task OnConnected()
{
Is never hit on the third connection unless I terminate one of the other two. So sharing the internals of these methods/functions would only add confusion I feel.
$.connection.hub.starting(function () {
console.log('starting')
});
$.connection.hub.received(function () {
console.log('connection received')
});
On the third client, starting his put in the console but received isn't.
I believe I was able to discover the answer to this after much hair pulling out and frustration.
Because desktop IIS only allows 10 concurrent connections and websocket connections are so dynamic I think that it was acting as 10 connections with only 2 actual connections.
http://www.asp.net/signalr/overview/getting-started/supported-platforms
"full versions of IIS or Cassini should not be used, since there will
be a limit of 10 simultaneous connections imposed, which will be
reached very quickly since connections are transient, frequently
re-established, and are not disposed immediately upon no longer being
used. IIS Express should be used on client operating systems."
If that is not the case then someone please correct me!
As a work around I am going to use IIS Express, my reasoning behind not wanting to was becauase I wanted my site exposed so my co-workers could connect and sanity test. I figured out how to expose IIS to the web and run it from a command prompt so I can develop while the server is up.
This is how to expose IIS Express
Go to
c:\Users[YourName]\Documents\IISExpress\config\applicationhost.config
Add(replacing IP address and port appropriately):
<binding protocol="http" bindingInformation="*:58938:192.168.1.42" />
To the relevant site.
Running IIS from command line
Open a command prompt.
You do not need Administrator user rights to run the commands in this
walkthrough. However, you must have Administrator user rights if you
want to run IIS Express on ports numbered 1024 or less. Run the
following command to navigate to the IIS Express installation folder:
cd \Program Files\IIS Express
or if you are using a 64-bit OS, run the
following command: cd \Program Files (x86)\IIS Express Run the
following command to view the IIS Express usage string:
iisexpress /site:site-name
and of course don't forget about port forwarding and firewall pass through.
I'm currently attempting to debug a solution that I've picked up as a side project but I'm not having much luck. The solution depends on data (user IDs, page content, etc) stored on an MSSQL server on my local network, but when I execute the solution in VS2012 debug mode the connection fails. The error I'm getting says that the connection failed, and that the user was rejected.
When I log into the SQL server and check the event logs I can see where the login ID was rejected, but it was rejected because it wasn't the login ID that I specified in the connection string. It seems to be trying to use my windows authentication instead (which in windows 8 is a live ID) which won't work because my windows ID doesn't (and shouldn't) have access to the server.
Some basic connection string info (all data changed to protect the innocent... aka my poor server)
Data Source=myServer; Initial Catalog=myDB; User ID=myUsername; Password=myPassword; Integrated Security=false;
Has anyone run into this issue?
Do a search in the entire solution for myServer. This should shed light on the issue, given the connection string is defined somewhere else and it connects to the same server.
When trying to access SharePoint WSS 3.0 server using the web services API the software service we are developing will hang anywhere between 30-60 seconds when making any call (pick anyone of them, it doesn't matter) against the server for the first time. After this first call is made , each request thereafter is very quick.
This happens on both the local dev install of SharePoint, or against the production SharePoint environment, same results no matter what we try.
When accessing the SharePoint site (both local dev and production) via a web browser using the same log in credentials used with the WSS API there is zero lag time during the authentication process.
This is the code being used via C# to authenticate to SharePoint WSS:
_lists = new Lists
{
Credentials = new NetworkCredential(UserName, Password, Domain),
Url = string.Format("{0}/_vti_bin/Lists.asmx", BaseUrl),
UseDefaultCredentials = false
}; // Reference the list object.
Once the code hits the line below it hangs for 30-60 seconds.
the GetList(string listName)
_lists.GetList("TestList");
Any call thereafter is extremely fast.
One last note. When trying to access the service via Visual Studio, we receive the popup dialog to enter credentials, Discovery Credentials, and it will not authenticate, but we are able to retrieve the list of services. This occurs on both the production and test environments.
Please see images in order of events for adding a web service:
Add Web service:
Next we get three dialog for list, error and meta data and none of them validate.
Close Up for First screen:
We finally hit cancel.
And can see the calls we can make against the service:
Anyone have any ideas?
After about 4 days of searching I came across a clue.
The clue was to change the authentication in the Central Admin of SharePoint to allow anonymous in addition to the Windows authentication mode.
Once that change was made it seems that might have been the fix. The response time went from 30-60 seconds to 1-4. It isn't a 100%, but it allows us to keep developing at a quicker rate.
I hope this might help someone facing the same issues. It was a nightmare. I have no hair left.
Update: This is not a 100% fix.
I have a Windows service written using Topshelf. I'm trying to configure it to run using a Windows account with restricted privileges rather than using LocalSystem. That's also necessary as I'd like to connect to a database using integrated authentication.
The service works when run as LocalSystem (albeit with a database connection string containing credentials) and running the console application as my limited account (using runas) also works.
However, when I try to start the service the service control manager times out waiting for a response:
The service did not respond to the start or control request in a timely fashion.
I also get the following in the Application Popup event log:
Application Error : The exception unknown software exception (0xc06d007e) occurred in the application at location 0x77e4bef7.
The first thing that the application does is writes to a log file but it doesn't reach that when I start the service. The logging works if I run via the console.
Any suggestions what I might be missing or what I might try next?
This problem seems to be related to the server (a domain controller) rather than TopShelf. A service built with the .NET service component also exhibits the same behaviour.
The service runs successfully on a different machine (in the same domain).
Unfortunately this doesn't help diagnose the problem but gives me an acceptable workaround.
Check the MSDN article Debugging windows services which describes how you debug windows services.
I've just started seeing this on a few of my services written in .net 2.0. They'll start fine when the server boots, but if I were to restart them throughout the day, they would not start, and give this error message.
They currently ran under a domain account which has admin rights on the box, but for kicks, I switched it to Local System, and the service started normally. I stopped it, changed it back to the domain account (reentering the password), and it started normally again as expected.
Don't know if this counts as a 'fix' so much, but that's what worked for me.