I create a MVC 4 application (WebAPI or empty) and I load the Breeze NuGet packages and hit F5 like they say I should, if I run in Google Chrome or Page Inspector all goes well, if I run in the current IE 10 I get an exception on the last line:
(function (root) {
var ko = root.ko,
breeze = root.breeze,
logger = root.app.logger;
// service name is route to the Web API controller
var serviceName = 'api/BreezeSample';
// manager is the service gateway and cache holder
var manager = new breeze.EntityManager(serviceName);
Essentially root.breeze is undefined, any idea why this is happening? How would the browser influence that?
How would I fix it? (I'm using VS 2012 Express for Web with all the updates loaded)
Adriaan,
I tried to replicate your error but could not. Here are the steps I used to get it up and running in IE10 (also using VS Express 2012 for Web):
File
New Project...
ASP.NET MVC 4 Web Application (Visual C#)
Empty
Tools
Library Package Manager
Manage NuGet Packages for Solution...
Search for Breeze.
Install Breeze for ASP.NET MVC4 Web Api Sample.
Ok
I Accept
Close
F5
Everything worked as expected.
I know it isn't the same error you are having, but if it makes you feel better, I failed out the first time I tried this as I selected ASP.NET MVC 4 Web Application (Visual Basic) instead of the C# version. Sure to fail and embarrassing once I realized the mistake.
Related
I've created a new MVC 5 Project in VS2013 and when I create the project I gave the authentication mode to none because I planned to use signalr in my project later.
I didn't install any signalr related files instead of the two signalr js files (in my scripts folder). And there are no any startup class or OWIN.
But when I run my application there are signalr calls going and going using longpooling. These things can be viewed in the firebug console.
Previously I've used signalr with many projects using VS 2012 MVC4 this is the first time I'm using MVC5. And this slows down my application. How this could be happened.
Here is the POST message...
Please help..
This is a dev tool only, it's not actually part of your application. I suggest you read this intro which also tells you how to disable the feature.
I'm having problems making HTTP requests from my MVC.Net Intranet application. I encountered the problem when using the RestSharp library, but have boiled it down to a much simpler repro.
The following code:
using (var client = new WebClient())
{
var contents = client.DownloadString("http://www.google.com");
}
Will run successfully (on my local machine, debugging from Visual Studio 2013) inside a console app.
Will run successfully (on my local machine) from within LinqPad
Times out (on my local machine, debugging from Visual Studio 2013, hosted with IIS Express) when run from a controller action in a MVC intranet app.
This may be a duplicate of Not able to connect to website URLs from Asp.Net WebApi Action Methods (and is where I got the boiled down proof-of-problem code above) but in my case this is all running locally on my computer and it works fine from a console app.
I've tried various different code snippets, including using HttpClient instead of WebClient:
using(System.Net.Http.HttpClient c = new System.Net.Http.HttpClient())
{
var msg = c.GetAsync("http://www.google.com").Result.Content.ReadAsStringAsync().Result;
}
But I get the same, or similar results and errors in all cases. For the code above, I eventually get a 'TaskCancelled' exception, with no Inner Exception.
I've also got colleagues to try the same on their own machines, with the same results. I have read some similar questions, where people talk about problems with deadlock due to the SyncronizationContext in ASP applications, but that seems to relate to asynchronous calls. Here, as far as I can tell, everything I am doing is synchronous so I can't see how that applies.
In reality, I'm using the RestSharp library, which I've used to create a client library of my own for talking to the facebook API. I had tested this from a console app test-harness, which worked perfectly, but it all times out when I start using it inside my MVC app.
Has anyone seen this before and have any ideas on where I'm going wrong, or what the issue might be?
Is it to do with locking / deadlocking?
Could it be to do with permissions / proxy? We have quite strict web proxy rules at work, which are obviously configured correctly for my user. Could IIS Express hosting be changing the permissions or the user assigned to the app? The IIS Express service is running with my username at present.
UPDATE
I have tinkered some more and tried accessing an internal company web page instead of an external page (Google). I find that this works immediately - so that suggests strongly that it's to do with permissions or proxy settings.
Can anyone explain why this would be different between a console app and a MVC application?
UPDATE 2
I've run Fiddler to check the request and see what was happening to it. When fiddler is running the request succeeds.
This makes me think it's some strange permissions issue possibly? As a security measure, our login accounts don't have admin rights, instead we have a separate non-interactive account with admin permissions we can use to run apps that need admin rights, or install software etc. To get fiddler to capture traffic, I have to run it with this account.
Still, the calls work fine with my own normal account from the console app or LinqPad - so I guess my question becomes:
For an asp / MVC app locally hosted via IIS Express (Visual Studio Debugging), what user will this be run as, and what differences (if any) would there be to a console app?
I am moving an asp.net web forms application over to mvc. I want to re-use as much code as possible so I decided use my existing linq to sql library.
I am new to MVC, but have viewed numerous videos from PluralSite for direction.
I created a model library to work between the linq to sql and the web api. I had read that I needed to do this because of linq to sql's complexities.
I have also created a web api and started adding linq queries to the controllers.
public IList<Model.vSchedulesFill> GetCustomerSchedules(int id)
{
var sch = from p in _context.vSchedulesFills
where p.CustomerID == id
orderby p.SchedStartDateTime descending
select new Model.vSchedulesFill(p);
return sch.ToList();
}
I tested the above query using Fiddler and the result were good, so I tried to run the program and received the HTTP Error 403.14 - Forbidden error.
The database is on a remote server, but I am running the app in debug mode on my local machine.
The error mentions no default document or IIS directory browser not turned on.
I looked up the default document and saw a lot about adding the web api help file. So I went to NuGet and installed it, but the application still will not run.
I have looked all over for solution to this problem...
What am I doing wrong and what do I need to do to fix this?
Thanks for your help
Added
<directoryBrowse enabled="true" />
to web config under section system.webServer.
Can view directory but that's not what I needed. I basically wanted to be able to run the program and then type in the path in the address bar, like I did in Fiddler.
I didn't remove any of the default layout forms included in the web api project.
Thanks
I have joined a team developing an ASP.NET MVC version 1 application. I run this app on my local machine using IIS version 7.5. My operating system is Windows Server 2008 R2 Enterprise Edition. I use Visual Studio 2008 SP1 for development.
One of the controllers in this app is called ReportsController. The route table entries for this controller use 'Reports' as the controller name part. The problem I have is that, using IIS 7.5 on my local machine, I simply cannot access any of the Reports action methods. If I try to access, say, '/Reports/Index' from Chrome or Firefox, I get a 401 Unauthorized response (as seen using Fiddler) and the browser displays its username/password entry dialog.
Please note the following:
All other non-Report pages in the application work correctly.
If I add a breakpoint to Application_BeginRequest, it is not hit when requesting a Reports page.
If I change the Reports routing entries in the route table registration code so that I have to access paths like '/Reportss/Index' (note the extra 's') then these Reports pages work correctly.
I have tried deleting then recreating my Web application in IIS.
The Reports pages work fine if I run the application using the Visual Studio 2008 development server (Cassini).
There is no directory called Reports in the application directory.
The Reports pages work correctly on our UAT environment, also under IIS 7.5.
I have reviewed my IIS setting several times, including comparing them with those on UAT, and I can't see a problem.
While I can use Cassini to access the Reports pages, I would really like to understand what is causing this issue.
If you have Reporting Services installed on your machine. try to create a new web site and use it. If you have SSRS installed on your machine it uses /reports for hosting reports.
I have had problems using the directory name 'Reports' at the root of a .net 2.0 website on IIS 7.5. It generates a 503 Error, indicating that there is an error at the system level before IIS tries to serve the page. I am not sure if reporting services is installed on my server. I just changed the directory name, all links and everything worked.
I have the exact same issue in my MVC Application with reporting services installed on the same server where code was deployed. I have changed the Reporting Manager URL in "SQL Server Reporting Services Configuration" which was hostName/Reports and assigned a new name i.e. SSRSReports so the virtual directory is now hostName/SSRSReports.
Now my application as well as SSRS Reports are working as expected.
I'm having this error trying to debug my ASP.NET MVC app. I've set the app to "Use Local IIS Web server", and selected ASP.NET as the debugger. Running the site without debugging works just fine, but when I try to debug, I got this error:
Unable to start debugging on the web server. The web server could not find the requested source.
I'm using Visual Web Developer 2008 Express Edition.
Does anyone know how to fix this error? Thank you.
For those encountering this with Visual-Studio 2012 and/or Windows 8 do the following.
You have to add .Net 3.5 (or 4.5) to your Turn Windows Features on or off window. You get to it via :
Control Panel -> Programs -> Turn Windows Features on or off
Click the Asp.Net 3.5 and the Asp.Net 4.5 check box in the IIS > WWW Service > Application Development Features folder.
Go to your web project's properties, then the "web" tab, then make sure that you're using the Visual Studio Development Server and not Local IIS or the custom webserver. I'm on VS2010 with Win7 and another developer was developing using a custom webserver URL and not the VS Dev Server
Sounds like you are trying to develop on IIS and not iis express or development server. If you are using asp.net mvc 4, make sure that the Application Pool is framework 4. If not just make sure that your app pool it matches your asp.net mvc version.
I had the same problem, and i fixed this way:
Go to IIS Manager -> Go to the site -> Error Pages -> Actions: edit feature settings.. -> Make sure you checked "detailed errors for local requests and custom error pages for remote requests".
IF you are using IIS6 and did the add mapping for .* in IIS trick to get MVC working, when you added the .* handler to iisapi.dll you forgot to uncheck the "check the file exists" check box.
Also, be sure that the URL you're configuring in Visual Studio matches your Host Headers (Edit Bindings) in IIS. This tripped me up for about an hour this morning before I realized my very stupid error.
Having maxRequestLength or maxAllowedContentLength set to a ridiculously large or small value will also trigger this error.
What i did, was just type the IP address in the web tab instead of "localhost"
This happened to me today. Turned out to be that the default website was stopped in iis. I had been working on a second website that didn't use it for a long time. Simple fix but took me a while to see it!
The root cause for this error can often be that the Windows Service W3SVC is not started. Check that this service in Windows Services console (services.msc) is started. In IIS you will now see the the Start icon is greyed out. This means that the W3SVC service is running.