I have deployed an ASP.net enabled WCF service but the javascript returned by the service is outdated.
Do I have to manually refresh it?
Turns out it is not allowed to move the cs files outside to App_Code folder
Related
I have an application I'm deploying to azure.
It's a SPA app which uses REST API.
I placed the folder of the app in side the wwwroot folder.
when I try to access the API from my local machine i.e. my localhost:1979/api/auth/login
I can do it but after I place the files in the www folder - I get a 404
when trying to access:
domain.com/api/auth/login
I tried doing it on my machine on my local IIS and got the same error.
I'm sure it's a stupid thing like configuration but I can't figure it out.
Thanks for any help
Solved
Ok.
So I checked the issue on my local IIS and got the same problem.
The thing is, I created a directory inside an existing solution which have the web api + mvc.net and called the directory which contains the html i.e. mydomain.com/dist/index.html directly.
The solution was to send the html file via the controller so when a user comes in to the site, the home controller will send the html file and the ajax call from the JS file which was download from the html will succeed unlike getting the html directly.
I just created a simple test WebService with Asp.net called
MyWebService.asmx
I can't access it from exteriour, cause Visual Studio don't allow this..
So I wanted to make a own IIS Webserver to host my Webservice, but
how do I add my "MyWebService.asmx" to the IIS with the IIS-Manager?
Hope someone can help me.. Google didnt help me a lot
You have to publish this WebService (right click on the project -> Publish) and host it using IIS like a regular Web Application.
Just create a new application, as you would do if you create a "real" ASP application
put, for completeness and to be sure the app is running a default.aspx into the root dir, which says something like "app is running!"
put the ASMX file into the directory (i think it will be place in the APP_CODE directory, but i'm not sure 100%)
config your webservice in the global.asax, without it nothing will happen (hint: also configure the help page for webservices, otherwise users accessing it will get the interface description in the browser)
A longer description of that can be found here: http://msdn.microsoft.com/en-us/library/8wbhsy70%28v=vs.80%29.aspx
Say I have this url:
http://site.example/dir/
In this folder I have these files: test.ascx.cs and test.ascx
Just to be clear, I am not a .NET developer.
From a security point of view - why can't I access http://site.example/dir/test.ascx.cs and how secure is it to keep those files there?
I assume IIS filters out request that query these kind of files, but can someone explain me this?
Thank you.
You just explained it yourself. IIS won't serve those files.
When you register ASP.NET with IIS (aspnet_regiis.exe) it will add common extensions and associate them with the ASP.NET handler. As far as the .cs extension is concerned it is filtered and not served by IIS. It is absolutely safe to have these files there, but I would recommend you to use an ASP.NET application project (in contrast to ASP.NET website) which is precompiled and you don't need to deploy source code files on your server.
(source: wewill.cn)
We have a web application written in ASP.NET 3.5. In it, we access a file in the code-behind. (Ordinary C# file access, done on the server during the page life-cycle, this has nothing to do with URLs or web browsers).
On our production systems, we specify the full path to the file in question in the web.config. We'd like to be able to include a local copy of the file in the project in version control, and then to use a relative path in the version-controlled web.config to point to it, so that a checked-out copy of the application could be run from within Visual Studio's debugger without having to do any configuration.
The problem is that when the web application is running in debug mode, its working directory is neither the project nor the solution directory. In a windows or console application, in a project's properties page I can set the working directory. But in a web application I cannot.
Any ideas on how I can manage to make this work?
To get the path of the root of the application:
//equivalent to Server.MapPath("/"); if at domain root, e.g Http://mysite.com/
string path = Server.MapPath("~");
This answer gives a rundown of a few different common Server.MapPath() uses that may also be of use to you.
In code behind: HttpContext.Current.Server.MapPath("~")
Use:
Server.MapPath("~");
When I added service -> web service. The VS2008 added a App_WebReferences folder without a .asmx file. I see a .discomap file.
When I use the cascading drop down ajax control, it is looking for .asmx in the service path. Am I doing it wrong? I remember the early edition of Visual Studio added a .asmx file when you added a outside webservice reference.
EDIT:
I don't think I'm clear on my question. I have a ASP.net Webservice application that is setup on localhost/service. I want to reference to that service in my asp.net website. I first added the project to the service in the soultion add existing project then on my website i added the web reference via localhost/service. It now have a folder App_WebReferences and the service folder along with service.discomap, service.disco and service.wsdl
when i try to use the cascading drop down extension. the service path is looking for .asmx file so how do i setup the service path for the ajax extension?
If the dropdown needs to call the web service, just give it the URL of the web service (ex: http://localhost/mywebservice/service1.asmx). I believe you'll also need to give it the name of the web method to call.
You won't need to add a web reference to your project unless you plan to call the web service manually.
You added a reference to an external service. You'll want to create a new web service by right clicking on your project, then Add New Item and selecting Web Service.
Also note that if you make a folder, say, WebServices, and add the asmx there, it'll place the .cs file in App_Code. If you have a web application project, I'm not sure where it would put it since there is no App_Code.