简体   繁体   English

如何使用localDB将ASP.NET MVC 4应用程序部署到Windows 7上的本地IIS?

[英]How to deploy ASP.NET MVC 4 application using localDB to local IIS on Windows 7?

When I try to run my ASP.NET MVC 4 application using Local IIS on Windows 7 with Visual Studio 2013. I run into the following error when the application tries to connect to localDB\\v11.0 当我尝试使用Visual Studio 2013在Windows 7上使用本地IIS运行我的ASP.NET MVC 4应用程序时。当应用程序尝试连接到localDB \\ v11.0时,我遇到以下错误

Server Error in '/' Application. '/'应用程序中的服务器错误。

A network-related or instance-specific error occurred while establishing a connection to SQL Server. 建立与SQL Server的连接时发生与网络相关或特定于实例的错误。 The server was not found or was not accessible. 服务器未找到或无法访问。 Verify that the instance name is correct and that SQL Server is configured to allow remote connections. 验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details. ) (提供程序:SQL网络接口,错误:50 - 发生本地数据库运行时错误。无法创建自动实例。有关错误详细信息,请参阅Windows应用程序事件日志。)

The 2 event logs are 2个事件日志是

Unexpected error occurred while trying to access the LocalDB instance registry configuration. 尝试访问LocalDB实例注册表配置时发生意外错误。 See the Windows Application event log for error details. 有关错误详细信息,请参阅Windows应用程序事件日

and

Cannot get a local application data path. 无法获取本地应用程序数据路径。 Most probably a user profile is not loaded. 很可能没有加载用户配置文件。 If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user. 如果在IIS下执行LocalDB,请确保为当前用户启用了配置文件加载。

Most solutions I found online references this post: http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx 我在网上找到的大多数解决方案都参考了这篇文章: http//blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx

The only difference I see between the described situation and my situation is that the described error code is 0 whereas my error code is 50. However, the proposed solution does not work for me. 我在描述的情况和我的情况之间看到的唯一区别是所描述的错误代码是0而我的错误代码是50.但是,建议的解决方案对我不起作用。

I cannot get past this error even if I set modify setProfileEnvironment to true and I've spent hours of time playing around with different processModel parameters and application pools. 即使我将修改setProfileEnvironment设置为true并且我花了数小时的时间来使用不同的processModel参数和应用程序池,我也无法通过此错误。

I was also suffering from same problem, but there is a solution for it. 我也遇到了同样的问题,但有一个解决方案。

Go to the IIS server, and then to the application pool from which your application is running. 转到IIS服务器,然后转到运行应用程序的应用程序池。 In the advanced settings of the application pool there is a "Process Model" option, under which there is an "Identity" option. 在应用程序池的高级设置中,有一个“过程模型”选项,在该选项下有一个“标识”选项。 This is by default the application pool identity. 默认情况下,这是应用程序池标识。 Change it to Local System, and you're done. 将其更改为本地系统,您就完成了。

And Remember to Put App_Data Folder their in WWW folder of IIS server 并记住将App_Data文件夹放在IIS服务器的WWW文件夹中

Try this,this will solve your problem: 试试这个,这将解决你的问题:

Edit the applicationHost.config file found in %windir%\\system32\\inetsrv\\config\\ specifically the ApplicationPools section. 编辑%windir%\\ system32 \\ inetsrv \\ config \\中的applicationHost.config文件,特别是ApplicationPools部分。

Change the IdentityType to NetworkService to use newly created database. 将IdentityType更改为NetworkService以使用新创建的数据库。

<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0">
   <processModel identityType="NetworkService" loadUserProfile="true" setProfileEnvironment="true" />
</add>

Make sure that the application pool uses an identity that has access to the desired instance of the LocalDB. 确保应用程序池使用可以访问所需LocalDB实例的标识。

Then disable ASP.NET Impersonation in Authentication settings of the application. 然后在应用程序的身份验证设置中禁用ASP.NET模拟。 Otherwise, application uses IUSR_MachineName account to access the database. 否则,应用程序使用IUSR_MachineName帐户来访问数据库。

This setup may not be suitable for production environment but could be sufficient for database and application development. 此设置可能不适合生产环境,但可能足以用于数据库和应用程序开发。

Maybe this will help someone. 也许这会对某人有所帮助。 I had the same problem installing an empty Epise3rver 7.5+ version but it was clear it did not have to do with any settings or configurations since my colleagues did not have this problem. 我有同样的问题安装一个空的Epise3rver 7.5+版本,但很明显它没有任何设置或配置,因为我的同事没有这个问题。 I ended uninstalling all MSSQL-related applications and reinstalled MsSQL Express 2014. And it worked! 我结束了卸载所有与MSSQL相关的应用程序并重新安装了MsSQL Express 2014.它工作正常! I tried before to install 2014 but it didn't change anything so as said I then uninstalled everything MsSQL-related before installing 2014 again. 我之前尝试安装2014但它没有改变任何东西,所以我说再安装2014之前我卸载了所有与MsSQL相关的东西。 Hope it helps. 希望能帮助到你。

Using MVC 5.2.3.0 I had a similar issue...added this to my web.config. 使用MVC 5.2.3.0我有一个类似的问题...添加到我的web.config。

<!-- Configure the Sql Membership Provider -->  
<membership defaultProvider="SqlMembershipProvider" userIsOnlineTimeWindow="15">  
  <providers>  
    <clear />  
      <add   
        name="SqlMembershipProvider"   
        type="System.Web.Security.SqlMembershipProvider"   
        connectionStringName="SqlConn"  
        applicationName="MembershipAndRoleProviderSample"  
        enablePasswordRetrieval="false"  
        enablePasswordReset="false"  
        requiresQuestionAndAnswer="false"  
        requiresUniqueEmail="true"  
        passwordFormat="Hashed" />  
  </providers>  
</membership>  

https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-use-the-aspnet-membership-provider https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-use-the-aspnet-membership-provider

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将ASP.Net MVC 5部署到IIS 8 Windows Server 2012? - How to deploy ASP.Net MVC 5 to IIS 8 Windows Server 2012? MVC5 ASP.net Identity 2.0用户管理以及从localDB部署到IIS服务器8 - MVC5 ASP.net Identity 2.0 user management and deploy from localDB to IIS server 8 如何使用IIS将ASP.NET应用程序部署到localhost? - How to deploy an ASP.NET application to localhost using IIS? ASP.NET MVC 3 - 如果在IIS 7.5上部署为应用程序,则找不到图像 - ASP.NET MVC 3 - Images not found if deploy as application on IIS 7.5 使用本地计算机上的IIS8在Windows Server 2012上托管Asp.Net MVC 4应用程序 - Hosting an Asp.Net MVC 4 application on windows server 2012 with IIS8 from a Local Machine 如何在本地iis上部署asp.net Web应用程序? - How can I deploy an asp.net web application on my local iis? 启用到Windows 7本地IIS asp.net应用程序的远程连接 - Enabling remote connection to Windows 7 local IIS asp.net application 将ASP.NET MVC网站部署到IIS 8 - Deploy asp.net mvc website to iis 8 如何将ASP.NET MVC 5 Angular 4应用程序部署到IIS服务器中? - How to deploy ASP.NET MVC 5 Angular 4 app into IIS server? 如何将 ASP.NET 核心 web 应用程序部署到 ZAEA23489CE3AA9B6406EBB28E0CDA4016 上的 IIS 应用程序 - How to deploy ASP.NET core web application to IIS on Windows Server 2016
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM