Even though I have set up visual studio to run IIS Express 64 bit, it continues to start IIS Express 32 bit. I need to run the 64-bit version because I have some references that will only work on a 64-bit host environment.
This problem happens on both versions of visual studio 2015 (Enterprise 14.0.25431.01 Update 3) and 2017 RC (Professional public.d15rel/15.0.26014.0)
I cannot use the local IIS because I'm using ASP.NET Core.
On a worst case scenario, I could run IIS Express manually but I've not been able to do it successfully. I was able to run IIS but I was not able to run the website or being able to debug. (I used this page for help https://host4asp.net/run-iis-express-from-the-command-line/)
Additional information:
System.AggregateException: One or more errors occurred. ---> System.NotSupportedException: Partition routing information cannot be extracted from the query when running in a 32-bit process. To complete your query and avoid this exception, ensure that your host process is 64-bit. For Executable applications, this can be done by unchecking the "Prefer 32-bit" option in the project properties window, on the Build tab. For VSTest based test projects, this can be done by selecting Test->Test Settings->Default Processor Architecture as X64, from Visual Studio Test menu option. For locally deployed ASP.NET Web applications, this can be done by checking the "Use the 64 bit version of IIS Express for web sites and projects", under Tools->Options->Projects and Solutions->Web Projects. at Microsoft.Azure.Documents.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfo(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextBase.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Linq.DocumentQuery
1.<CreateDocumentQueryExecutionContextAsync>d__12.MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result() at Microsoft.Azure.Documents.Linq.DocumentQuery
1.d__b.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable
1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at TestWebWithDocDb.Controllers.TestController.tester3() at lambda_method(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext() ---> (Inner Exception #0) System.NotSupportedException: Partition routing information cannot be extracted from the query when running in a 32-bit process. To complete your query and avoid this exception, ensure that your host process is 64-bit. For Executable applications, this can be done by unchecking the "Prefer 32-bit" option in the project properties window, on the Build tab. For VSTest based test projects, this can be done by selecting Test->Test Settings->Default Processor Architecture as X64, from Visual Studio Test menu option. For locally deployed ASP.NET Web applications, this can be done by checking the "Use the 64 bit version of IIS Express for web sites and projects", under Tools->Options->Projects and Solutions->Web Projects. at Microsoft.Azure.Documents.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfo(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextBase.<GetPartitionedQueryExecutionInfoAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.<CreateDocumentQueryExecutionContextAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Linq.DocumentQuery
1.d__12.MoveNext()<---
host.run()
from the Program class that says:"An attempt was made to load a program with an incorrect format.
(Exception from HRESULT: 0x8007000B)".
I guess this happens because I'm trying to run a 64-bit version over a 32-bit platform (IIS Express).
I'm attaching a sample code. tester action works but tester3 action produce the error on line "var list = res.ToList();".
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Documents.Client;
using System;
using System.Linq;
using SomeNamespace;
using Newtonsoft.Json;
using System.Globalization;
namespace TestWebWithDocDb.Controllers
{
public class TestController : Controller
{
public IActionResult tester()
{
var client = new DocumentClient(new Uri("https://xxxxxxxxxxxxxx.documents.azure.com:443/"), "xxxxxxxxxxxxxx");
//var query = "Select * from Main";
var res = client.CreateDatabaseQuery().Where(db => db.Id.Equals("xxxxxxxxxxxxxx")).AsEnumerable().FirstOrDefault();
return this.Content("OK", "text/plain");
}
public IActionResult tester3()
{
var Query = "Select * From Main ";
var client = new DocumentClient(new Uri("https://xxxxxxxxxxxxxx.documents.azure.com:443/"), "xxxxxxxxxxxxxx");
var databases = client.CreateDatabaseQuery().ToList();
var a = client.AuthKey;
var _db = client.CreateDatabaseQuery().Where(db => db.Id.Equals("xxxxxxxxxxxxxx")).AsEnumerable().FirstOrDefault();
if (_db == null)
{
throw new ApplicationException("no db");
}
var _col = client.CreateDocumentCollectionQuery("dbs/" + _db.Id).Where(c => c.Id.Equals("Main")).AsEnumerable().FirstOrDefault();
if (_col == null)
{
throw new ApplicationException("no collection");
}
var _path = "dbs/" + _db.Id + "/colls/" + _col.Id;
var res = client.CreateDocumentQuery<BreederDocument>(_path, Query);
var list = res.ToList();
var resOut = list;
return this.Json(resOut);
}
}
}
namespace SomeNamespace
{
public abstract class DocumentBase : Microsoft.Azure.Documents.Resource
{
protected String _changedBy;
protected DateTime _created;
protected Byte _DType;
protected DateTime _modified;
protected String _name;
protected Guid _UID;
protected String _version;
/// <summary> Constructor </summary>
public DocumentBase()
{
_changedBy = "";
_created = DateTime.Now;
_DType = 0;
_modified = DateTime.Now;
_name = "unknown";
base.Id = Guid.NewGuid().ToString();
_version = "1.0";
}
[JsonProperty("changedBy", Order = 202)]
public string ChangedBy
{
get { return _changedBy; }
set { _changedBy = value; }
}
[JsonProperty("created", Order = 200)]
public DateTime Created
{
get { return _created; }
set { _created = value; }
}
[JsonProperty("DType", Order = 0), JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public Byte DType
{
get { return _DType; }
set { _DType = value; }
}
[JsonProperty("id", Order = 3)]
public string id
{
get { return base.Id; }
set
{
Guid UID = Guid.Empty;
if (!Guid.TryParse(value, out UID))
{
throw new Exception("Cannot set id: value is not a valid GUID");
}
else
{
base.Id = UID.ToString();
}
} // end set
} // end property
[JsonProperty("modified", Order = 201)]
public DateTime Modified
{
get { return _modified; }
set { _modified = value; }
}
[JsonProperty("name", Order = 10)]
virtual public string Name
{
get { return _name; }
set { _name = value; }
}
[JsonIgnore]
public Guid UID
{
get { return Guid.Parse(id); }
}
[JsonProperty("version", Order = 1)]
public string Version
{
get { return _version; }
set { _version = value; }
}
} // end class
public class BreederDocument : DocumentBase
{
TextInfo tInfo;
public BreederDocument() : base()
{
tInfo = CultureInfo.CurrentCulture.TextInfo;
_DType = 10;
//_AccountID = Nothing
}
/// <summary> The AccountID for this breeder </summary>
/// <returns></returns>
[JsonProperty("accountID", Order = 9)]
public string AccountID
{
get { return _AccountID; }
private set { _AccountID = value; }
}
private string _AccountID;
[JsonProperty("name", Order = 10)]
public override string Name
{
get { return _name; }
set
{
if (value != null) { value = tInfo.ToTitleCase(value); };
if (_name != value)
{
_name = value;
}
}
}
/// <summary> Short Name </summary>
/// <returns></returns>
[JsonProperty("shortName", NullValueHandling = NullValueHandling.Ignore, Order = 11)]
public string ShortName
{
get { return _ShortName; }
set
{
if (value != null) { value = tInfo.ToTitleCase(value); };
if (_ShortName != value)
{
_ShortName = value;
}
}
}
private string _ShortName;
/// <summary> Kennel Name </summary>
/// <returns></returns>
[JsonProperty("kennelName", NullValueHandling = NullValueHandling.Ignore, Order = 12)]
public string KennelName
{
get { return _KennelName; }
set
{
if (value != null) { value = tInfo.ToTitleCase(value); };
if (_KennelName != value)
{
_KennelName = value;
}
}
}
private string _KennelName;
[JsonProperty("webSite", Order = 22)]
public string WebSite
{
get { return _WebSite; }
set { _WebSite = value; }
}
private string _WebSite;
[JsonProperty("sponsored", NullValueHandling = NullValueHandling.Ignore, Order = 30)]
public string Sponsored
{
get { return _Sponsored; }
set { _Sponsored = value; }
}
private string _Sponsored;
[JsonProperty("initialPassword", NullValueHandling = NullValueHandling.Ignore, Order = 50)]
public string InitialPassword
{
get { return _InitialPassword; }
set { _InitialPassword = value; }
}
private string _InitialPassword = null;
} // end class
} // end namespace
NuGet packages installed in solution: NuGet packages installed in solution
System.NotSupportedException: Partition routing information cannot be extracted from the query when running in a 32-bit process.
According to the error you provided, I assumed that your collection mode is partitioned. Some detailed information about this error, you could refer to this issue on git. If you do not use partition routing feature in DocumentDb you could try to change your code and provide FeedOptions
to disable EnableCrossPartitionQuery
.
I was able to make it work in VS 2017 by modifying tag RuntimeIdentifier of web project (*.csproj) like in the image below.
The RuntimeIdentifier was changed from win7-x86 to win7-x64. With that change the IIS Express 64 bit was loaded.
You cannot change RuntimeIdentifier from the properties, you have to change it directly on the file.
After these changes, IIS Express 64 bit started running and the error was not thrown again.
The accepted answer did not work for me. Changing it to win10-x64 also didn't help.
What did help was to add false under the tag of the csproj project. It's also available through the UI by clicking on project properties -> Web tab -> Bitness (change to x64).
User contributions licensed under CC BY-SA 3.0