Visual Studio 2015和2017不会启动IIS Express 64位版本



即使我已经设置了Visual Studio来运行IIS Express 64位,它仍继续启动IIS Express 32位。我需要运行64位版本,因为我有一些只能在64位主机环境中使用的参考。

  • 我的项目是根据模板创建的。应用程序(.NET框架)"和,
  • 我已经建立了Visual Studio(2015和2017 RC)使用IIS Express64位通过转到工具/选项/"项目与解决方案"/" Web Projects"并检查选项"使用64位版本IIS Express用于网站和项目"。

此问题发生在Visual Studio 2015(企业14.0.25431.01更新3)和2017 RC(Professional.d15rel/15.0.26014.0)

我无法使用本地IIS,因为我使用的是ASP.NET核心。

在最坏的情况下,我可以手动运行IIS Express,但我无法成功地进行。我能够运行IIS,但我无法运行该网站或能够调试。(我使用此页面来帮助https://host4asp.net/run-iis-ebress-from-the-command-line/)

其他信息:

  • 迫使我尝试使用IIS Express 64位的错误是以下

system.AggregateException:发生一个或多个错误。---> system.notsupportedException:分区路由信息不能为 在32位过程中运行时从查询中提取。去完成 您的查询并避免此例外,请确保您的主机过程是 64位。对于可执行应用程序,这可以通过取消选中来完成 项目属性窗口中的"优先32位"选项, 构建选项卡。对于基于vstest的测试项目,这可以由 选择测试 ->测试设置 ->默认处理器体系结构为x64, 来自Visual Studio测试菜单选项。用于本地部署的ASP.NET Web 应用程序,这可以通过检查"使用64位版本 IIS Express用于网站和项目", 工具 ->选项 ->项目和解决方案 -> Web项目。 在microsoft.azure.documents.query.querypartitionprovider.getPartitionedqueryExecutionInfo(sqlqueryspec) QuerySpec,PartitionKeyDefinition partitionKeyDefinition,boolean required gormattabledorderbyquery,boolean iScontination thected)at microsoft.azure.documents.query.documentqueryExecutionContextBase.d__0.movenext() ---堆叠跟踪的结尾从以前的位置抛出了例外的位置--- system.runtime.compilerservices.taskawaiter.throwfornonsuccess(任务 任务) system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(任务 任务) microsoft.azure.documents.query.documentqueryExecutionContextFactory.d__3.movenext() ---堆叠跟踪的结尾从以前的位置抛出了例外的位置--- system.runtime.compilerservices.taskawaiter.throwfornonsuccess(任务 任务) system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(任务 任务) 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)在 system.threading.tasks.task 1.get_Result() at Microsoft.Azure.Documents.Linq.DocumentQuery 1.d__b.movenext() 在system.collections.generic.list 1..ctor(IEnumerable 1集合)
在system.linq.enumerabl.tolist [tsource](iEnumerable 1 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()&lt; ----

  • 如果我将Web项目设置为Target Platform X64,则Web项目从程序类上丢下host.run()的错误,该课程说:

"试图加载具有不正确格式的程序。
(Hresult的例外:0x8007000b)。

我想这是因为 我正在尝试通过32位平台运行64位版本(IIS express)。

我正在附加示例代码。Tester Action有效,但Tester3 Action在" 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软件包:解决方案中安装的nuget软件包

system.notsupportedException:在32位进程运行时,无法从查询中提取分区路由信息。

根据您提供的错误,我认为您的收集模式已分区。有关此错误的一些详细信息,您可以在GIT上参考此问题。如果您不使用DocumentDB中的分区路由功能,则可以尝试更改代码并提供FeedOptions至禁用EnableCrossPartitionQuery

我能够通过修改Web Project(*.csproj)的标签Runtime Identifier(如下图中)在VS 2017中起作用。

Runtime Identifier从Win7-X86更改为Win7-X64。随着该更改,IIS Express 64位加载。

您不能从属性更改Runtimeidentifier,您必须在文件上直接更改它。

这些更改后,IIS Express 64位开始运行,并且错误不会再次抛出。

*。csproj映像

接受的答案对我不起作用。将其更改为win10-x64也没有帮助。

有帮助的是在CSPROJ项目的标签下添加false。也可以通过单击项目属性 - &gt;也可以通过UI获得。Web选项卡 - &GT;比特(更改为x64)。

最新更新