Need to access my VM Windows 8 Local IIS from my M

2019-09-09 10:10发布

问题:

I'm doing all my mobile development on my Mac OS X (Xamarin Studio or native languages), and using Parallels to work my Microsoft Azure Mobile Services backend in Visual Studio. I've came to the point I want to test my Azure Mobile API, but I don't want to publish the service for every change and also debug it.

My problem is that I deploy to my IIS, express or local, works fine in terms of seeing the land page of the API on my Mac physical hosting machine but as soon as I click try it out I get an authentication message, check screenshot, I don't want any security to be applied right now.

How to disable it and test my Azure Mobile Service API from my Mac and eventually from my mobile projects.

[EDIT]

I should mention that from my VM Windows 8 the IIS is running properly and I can access the API without any username/password.

[EDIT 2] From @lindydonna answer.

The proxy seems to working fine since from my Mac I can call localhost/MyApiService and it goes to my Windows 8 VM Local IIS server.

So I have access the API server, all the controllers and their endpoints, you select an endpoint and get the sample screen, click try it out and fails to complete the HTTP request, 404/NotFound error. See screenshot.

The BODY of the GET request in this gist.

The above is a problem in the Local IIS settings since the same behavior applies in the Windows 8 VM environment when trying the Azure Mobile Service test page.

I made it to work using Postman, it returns JSON data properly, the iOS simulator doesn't seem to work with localhost. The MobileServiceContext throws an exception when trying to pull.

protected virtual async Task PullAsync (IMobileServiceTableQuery<TEntity> query)
{
    try {
        await Initialization;
        IMobileServiceSyncTable<TEntity> entityTable = GetTable ();
        await entityTable.PullAsync (typeof(TEntity).ToString (), query); // <-- The System.Net.WebException thrown here.
        await entityTable.PurgeAsync ();
    } catch (MobileServiceInvalidOperationException preconditionFailedEx) {
            Debug.WriteLine(preconditionFailedEx.Message);
    }
}

回答1:

The problem is that your IIS Express instance is configured not to accept external network connections as a security precaution, and the Parallels VM is considered a different machine.

The easiest solution is to follow this Fiddler tutorial: Configure Fiddler for Mac, which will set up Fiddler as a proxy on the VM.

Then, on your Mac, you should modify your network settings and add a proxy setting that connects to the Fiddler proxy (http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForMac#configure-mac-). Your iOS simulator will pick up those proxy settings.

NOTE: the Fiddler setting opens up a port on the VM, which you should turn off once you are no longer using it, as a security precaution.

Also, according to this response (iOS 8 / Xcode 6 Simulator is not using HTTP Proxy anymore) you need to also restart your iOS simulator so that it picks up the new settings.



回答2:

Leave the username blank and use your Application or Master Key as the password.

Also answered here: Authentication for Azure Mobile Web Services test pages