Cannot get IIS 8 to properly authenticate to SQL Server 2012 - asp.net-mvc

I am running IIS 8 on a Windows 8.1 home premium machine. I'm trying to publish for my home network an MVC application that logs in to SQL Server (2012 Developer Edition) on the same machine.The SQL Server is set up to use Windows Authentication.
The published (to the local file system) MVC application works fine when used from Visual Studio 2013. When ran via IIS, it connects to the home page, but crashes the moment data is accessed with the message "Login failed for user 'WORKGROUP[my home machine]"
Can I get there from here? After research, I see that I cannot set the Authentication for IIS to Windows Authentication for a Home Premium machine (option is not there, only Anonymous, ASP.NET Impersonation and Forms Authentication are there and I could make none work). So what should I do? Change authentication on SQL Server? It should be so easy--both Web and Sql Servers are on the same machine! Any/all ideas very welcome!

Well, first off, there's no such thing as Windows 8 or Windows 8.1 Home Premium. There is only Windows 8.1 and Windows 8.1 Pro. The Home and Home Premium version names were dropped after Windows 7. Additionally, the IIS in Windows 8 does not have the same limitations that were present in earlier versions of IIS, although you still can't connect to a domain. You need 8.x Pro for that.
So, your problem here is that, by default, IIS uses the computer name (including Workgroup or Domain) to login to Sql Server when using Windows Authentication and Integrated security. All you have to do is add your computer to the authorized users for the database.
Simply go into SQL Server Management Studio, open up the server, go to Security->Logins and add the machine, then go to the database and add the newly created machine account to the database.

Ok , you need just add Authencitcated user ( if both IIS and sql server are on same Computer ) , ( NetworkService if they aren't on same Computer ) to database login .

Related

When browse from web server, Windows authentication not working

I have two servers,
WEB01_Server
APP01_Server
So my ASP.NET MVC application has two Projects
Sample_Web
Sample_Service
So my application architecture like following
so both these projects I hosted in APP01_Server So I enable the windows authentication(using IIS) for Sample_Web project and once I browse this web project in App server URL windows login prompt coming and successfully able to log in.
Once I browse with WEB01_Server URL, it also windows AD login prompt coming and but cannot log in.
Additionally, I enabled Windows authentication in WEB01_Server this application IIS web site instance and result is same.
Configuration wise What else I need to configure ?

ASP.NET MVC 4.5 - The issue with the Logon user (HttpContext.Request.LogonUserIdentity.Name)

I am developing an ASP.NET MVC 4.5.1 application using VS 2013.
Following are the settings at the IIS 7.5
Windows Authentication Enabled (also in Web.config authentication mode is set to "Windows").
Anonymous Authentication Disabled.
Application pool is running with service account "contoso\john".
The mode is Integrated.
On my landing page (e.g. HomeController.cs) I am storing logon user information as below:
Session["LogonUserName"] = HttpContext.Request.LogonUserIdentity.Name and that's working fine, I can use the Session["LogonUserName"] from other views.
However, when redirecting from home page to a different view e.g. Customer View something weird is happening and somehow I am losing the authentication and I am not able to step into a function.
So I Disabled the Windows Authentication and Enabled the Anonymous Authentication but then on the customer view page I am getting HttpContext.Request.LogonUserIdentity.Name = "NT AUTHORITY\IUSR"
and Session["LogonUserName"] = contoso\john, which is my app pool account.
Any idea why? Could someone please help me?
Ok. The issue certainly due to be authentication (XSS problem) and the JavaScript code wasn't being trusted when running on localhost or on IP address. When given a DNS entry (site binding) the issue resolved.

IIS Server is not responding to computer name:portnumber instead of localhost:portnumber

i have tried to deploys the MVC Application in IIS Server (Windows 7 Ultimate (32 bit)) i have configured my web site in localhost:81 is perfectly working. when i have use my computer name : 81 (Server-PC:81) is showing Service Unavailable HTTP Error 503. I have entered the same url (http://Server-PC:81) in network connected System is showing Web page as not found
Please notify me if i have missed any setting such as firewall etc in my pc or any other step i need to do. thanks in advance.

MVC internet application(iis express worker process is closing)

I have created ASP.NET MVC project using internet template. Then I have enabled external(facebook) authentication in AuthConfig file. Now when I run my project and get authenticated with facebook it is working just fine, but the problem is that associated iis express worker process is just closing approximately within 1 minute and VS debugging stops(as if I manually press the Shift+F5). I am getting no errors at all. This doesn't happen when I run the project with Chrome or if I just don't authenticate when using Internet Explorer. It only happens in Internet Explorer when I am authenticating with facebook.
Can anyone suggest what is going on?
Several observations:
when I am authenticated with local account problem doesn't occurs.
when I am authenticated with facebook it redirects to
http://localhost:27264/#_=_. May be #_=_ this is the problem?

asp.net mvc3 windows authentication only works on local computer

I have a mvc3 applicaiton using windows authentication. it works fine on my local pc.
<authentication mode="Windows" />
after I deploy it to the dev server. every time, i go to the site, a login popup shows up, I need to enter ID and password to access the site. on my local computer, I never see this popup login form. always automatically logged in. What do I need to change on the server side to fix this issue.
in the IIS, I disabled anonymous authentication, only enabled windows authentication. My computer and the serve are on the same domain.
You need to add the server to the local zone in internet explorer. The server needs to be added to the local intranet as it is not being automatically detected. Add the server to this list, restart IE and it will authenticate automatically.

Resources