Accessing webservice from remote machine - asp.net

I've developed a simple web service and hosted it on one of my machines in a LAN environment, but when i try to access the web service from another machine within LAN i got a prompt asking for username and password, web service is configured to be accessed anonymously. It is working fine on the machine where it's hosted. What's wrong with the settings, am i missing something?
This is a web service written in ASP.NET and hosted on IIS in machine say 192.168.1.1 and i wanted to access it on 192.168.1.2, the address of the web service is 192.168.1.1/myService/service.asmx but it keep displaying me username/password prompt.

Make sure that you have the Anonymous Authentication feature enabled in IIS: Enable Anonymous Authentication

I encountered the same problem. We were using "Windows Authentication" and could not use "Anonymous Authentication" for this project.
We were deploying an msi to test on VM's. I added the pre-compiled version of the 'asmx.cs' to the /bin directory of the installation. I only added the 'asmx' file to the root directory and this worked for me.
Hope that helps.

Related

ASP.NET MVC + WCF + IIS: Windows authentication doesn't work

We have a web site written in ASP.NET MVC that uses Windows Authentication.
We have a WCF service that we use to connect to the database and reference that service from our MVC site. The web.config for both the site and the service have enabled Windows Authentication and disabled Basic and Anonymous authentication.
Now, the issue is this:
If I restart the IIS and then open a browser in the same computer that has the IIS, everything works fine (even from outside that computer).
If I restart the IIS and then open a browser in an external computer, the WCF service is unable to connect to the database (even from the local machine).
So, if we don't open the site from the host computer before attempting to access it externally it won't work.
We are using impersonation to do the calls to the service from the website.
Any ideas on what can be happening?
your WCF service is impersonating the user of an outside user passed to by IIS passed to by the IE user. You want to hard code your application pool of your IIS we service to use a specific Service Account that has Network Service privileges
its working internally, as its using your identity on the Windows Domain(its in your ie settings in security) but externally this does not work.

ASP.NET error log

Every time the ASP.NET application in question throws an error the Global.asax writes to an error file: logs\error.log. The ASP.NET applications works using Windows authentication.
I am able to write to the log file when debugging using Visual Studio, however it does not work when the application is deployed in the live environment. How do I find out what user account I need to give access to: logs/error.log?
The application is deployed on a Windows 2003 Server with IIS6. Microsoft.NET 3.5.
You would have to give the required permissions to the network service account. This link might be able to help you out.
Windows Server 2003 defaults to the "Network Service" account.
This can be verified by opening IIS (expand the computer if needed), expand the "Application Pools" folder, right click on the pool used by your web app, and go to the Identity tab.
FYI: Windows Server 2008 uses the IIS_IUSER instead of Network Services.
I hope that logs folder is a virtual directory setup outside the web site directory.
Otherwise every time you deploy the entire solution you will overwrite the logs folder and its content.
Microsoft has a tool for monitoring file access that can be useful for troubleshooting permission issues.
Process Monitor - http://technet.microsoft.com/en-us/sysinternals/bb896645
You will also want to check if your application is using windows authentication & identity impersonation since that can change the identity the application is executing with when enabled.

Web service running on IIS cant access password protected folder on Linux machine

I am running a Web Service on a Windows XP pc and my goal is this service to access a folder located in the network (Samba Server) on a Linux machine.
The error that I am getting from the browser is "path format is not valid".
This means that IIS can't recognize the path at all.
My question is, whether this is a problem due to the password protection of the folder or is it a compatibility issue between IIS and Linux?
Is there anything I can do to fix it?
Thank you
I assume you granted access to the Samba share to some user ID - but which user ID?
The user under which an ASP.NET application runs is likely a machine account. Check your IIS settings for the name of that account.

ASP.NET app works on Cassini but not in IIS on xp?

App works fine in IIS on Windows 7 on my dev machine. Trying to debug on a client machine running XP and VS2008 and the app works ok running on Cassini, however when I select IIS I am getting a 403 forbidden error. Anonymous access is switched on in ISS. Can anyone help work out why it won't work in IIS?
try to add permission to this folder for Network Service user, may be help.
check that it isn't set to impersonate. Usually you just have to give permissions to Network Service (as mentioned by #loviji), but depending on your application and your computer configuration you may need to give permissions to the account that is configured for anonymous users in IIS.

Remote Debugging on IIS - Access Denied Nightmare!

We have two Win2k3 servers here, one is a domain controller and the other our webserver.
I'm running an ASP.NET MVC web app setup as a website in IIS on the webserver.
I've copied across the x86 remote debugging tools to the webserver, logged in to an admin account and ran msvsmon. I added the user I'm logged into my workstation as to the permissions list.
Opened up the web app project in VS2008 and went to Attach to Process, here are my settings:
Transport: Default
Qualifier: OURDOMAIN\AdminUsername#OURWEBSERVER
Attach To: Managed Code
Selected: w3wp.exe
Upon clicking Attach, the windows flicker for a few seconds and then I get:
Unable to attach to the process. Access is denied.
I've tried right-clicking msvsmon and using Run As to run it under the same account as I'm logged into my machine, but still no difference.
However, if I change the Attach To field to Auto: Native Code, it attaches fine, but I can't debug any of my managed .NET code.
This has me baffled - any ideas?
Anthony
Have you seen this article?
http://support.microsoft.com/default.aspx?scid=kb;en-us;833977&Product=vsnet
It's not clear from your question, but remote debugging requires that the user you are logged into on the remote machine exist on your local machine as well. You basically have to create a local account on your dev machine (yes, that sounds backwards). I'm not sure it respects domain accounts.
Is the code sitting precompiled on the server or in individual uncompiled .cs files?
I've tried right-clicking msvsmon and
using Run As to run it under the same
account as I'm logged into my machine,
but still no difference.
Did you add that account as an administrator in the server? I would try that, and instead of doing Run As, I would effectively log in with that account.
When running server and client in different domains, the plot thickens slightly. In those cases, the trick I use is to create a local account with the same name and same password on both machines. Login with the same account (it is not really the same account) in both machines and launch the remote debugger on the server and VS on the client. If any of the machines in this scenario is running Windows XP, you have to change the Local Security Policy, "Network access: Sharing and security model for local accounts", under "Security Options", to "Classic - local users authenticate themselves".
I have yet to see this work across domains. As with #paul-mrozowski, I've been able to do it on the same domain so long as the user running the debugger server matches your local user AND your able to properly auth against the machine. That last bit can be hampered by firewall configurations.

Resources