Search Results

Search found 1185 results on 48 pages for 'pulling hair out'.

Page 11/48 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Segmentation Fault (11) with modwsgi on CentOS 5.7 when running pyramid app

    - by carbotex
    I'm getting Segmentation fault error when trying to access the "Hello World" pyramid app. This error only occurs when running against CentOS 5.7 setup, but no problem whatsoever when tested against OSX and Arch Linux. Could it be a CentOS specific issue? [error] [client 10.211.55.2] Premature end of script headers: pyramid.wsgi [notice] child pid 31212 exit signal Segmentation fault (11) I have tried to follow the troubleshooting guides posted here http://code.google.com/p/modwsgi/wiki/InstallationIssues which suggests that it might caused by missing Shared Library. A quick check reveals that shared library is not the issue. [centos57@localhost modules]$ ldd mod_wsgi.so linux-gate.so.1 => (0x00e6a000) libpython2.7.so.1.0 => /home/python/lib/libpython2.7.so.1.0 (0x0024c000) libpthread.so.0 => /lib/libpthread.so.0 (0x00da8000) libdl.so.2 => /lib/libdl.so.2 (0x00cd6000) libutil.so.1 => /lib/libutil.so.1 (0x00110000) libm.so.6 => /lib/libm.so.6 (0x0085c000) libc.so.6 => /lib/libc.so.6 (0x00682000) /lib/ld-linux.so.2 (0x0012b000) Then I found another clue that might be able to solve my problem. Unfortunately libexpat is not the source of the problem. http://code.google.com/p/modwsgi/wiki/IssuesWithExpatLibrary [centos57@localhost bin]$ ldd ~/httpd/bin/httpd | grep expat libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x00b00000) [centos57@localhost bin]$ strings /usr/local/lib/libexpat.so.1 | grep expat libexpat.so.1 expat_2.0.1 [centos57@localhost bin]$ python Python 2.7.2 (default, Nov 26 2011, 08:08:44) [GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pyexpat >>> pyexpat.version_info (2, 0, 0) >>> I've been pulling my hair out trying to figure out what I'm missing in my setup. Why the problem only occurs with CentOS? Here is the detailed setup: Apache 2.2.19 Python 2.7.2 mod_wsgi-3.3 /home/httpd/conf/extra/pyramid.wsgi from pyramid.paster import get_app application = get_app('/home/homecamera/hcadmin/root/production.ini', 'main') /home/httpd/conf/extra/modwsgi.conf LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias /myapp /home/root/test.wsgi <Directory /home/root> WSGIProcessGroup pyramid Order allow,deny Allow from all </Directory> # Use only 1 Python sub-interpreter. Multiple sub-interpreters # play badly with C extensions. WSGIApplicationGroup %{GLOBAL} WSGIPassAuthorization On WSGIDaemonProcess pyramid user=daemon group=daemon processes=1 \ threads=4 \ python-path=/home/python/lib/python2.7/site-packages WSGIScriptAlias /hello /home/httpd/conf/extra/pyramid.wsgi <Directory /home/httpd/conf/extra> WSGIProcessGroup pyramid Order allow,deny Allow from all </Directory> Again this same setup works on OSX and Arch Linux but not on CentOS 5.7. Could someone out there point me to the right direction before I ran out of my hair. ==================================================================================== When apache started with gdb, I got a couple of warnings Reading symbols from /home/httpd/bin/httpd...done. Attaching to program: /home/httpd/bin/httpd, process 1821 warning: .dynamic section for "/lib/libcrypt.so.1" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/lib/libutil.so.1" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations gdb output. After hitting refresh button, to load pyramid. (gdb) cont Continuing. warning: .dynamic section for "/usr/lib/libgssapi_krb5.so.2" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/usr/lib/libkrb5.so.3" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/lib/libresolv.so.2" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x8edbb90 (LWP 1824)] 0x0814c120 in EVP_PKEY_CTX_dup () apache_error_log [info] mod_wsgi (pid=1821): Starting process 'pyramid' with threads=1. [info] mod_wsgi (pid=1821): Initializing Python. [info] mod_wsgi (pid=1821): Attach interpreter ''. [info] mod_wsgi (pid=1821): Create interpreter 'web.domain.com:20000|/hcadmin'. [info] [client 10.211.55.2] mod_wsgi (pid=1821, process='pyramid', application='web.domain.com:20000|/hcadmin'): Loading WSGI script '/home/httpd/conf/extra/pyramid.wsgi'. [error] hello 1

    Read the article

  • Does liquid cooling mean I no longer need to dust my machine?

    - by Starkers
    I've got two long haired cats, a dog and I live with a smoker. I use my computer pretty much all day everday, and though I put it to sleep in the night, those fans are constantly going during the day. In just 6 months the rear fans have so much hair wrapped around them it looks more like something from a vacuum cleaner rather than electronic equipment! Due to this, I'm interested in liquid cooling. However, it appears that liquid cooled systems have fans and liquid cooling? Are those just hybrid solutions? They wouldn't really help my situation. There does appear to be fanless systems that use a radiator to dissipate heat. If I implemented one of these could I seal up the vents on my PC and never have to dust it again? Is there a disadvantage to fanless liquid cooling? I don't need to overclock at the moment but I ever want to push my components will fanless liquid cooling be pretty rubbish?

    Read the article

  • XP Computer won't start (Missing/Corrupt 'System' file) - recently added new hard drive

    - by qwerty2
    Hi all, Pulling my hair out here. I recently replaced my D: 1TB drive (not a system drive) with a new 1.5TB drive. I loaded Windows XP, formatted the new drive and it was showing as working fine, alongside my C: windows system drive. I restart my machine and all of a sudden, Windows doesn't load and instead I get: "Windows could not start beause the following file is missing or corrupt" \WINDOWS\SYSTEM32\CONFIG\SYSTEM I don't have the original XP installation CD, although I do have another copy of XP, when I try and boot to it, I get the blue 'STOP' screen after it attempts to load the setup utlity for about a minute. Can someone please help? When I set up my new hard drive as a primary partition did this someone screw up my C: hard drive? Did it perhaps unmount it somehow? Any help would be fantastic. Thanks

    Read the article

  • XP Computer won't start (Missing/Corrupt 'System' file) - recently added new hard drive

    - by qwerty2
    Hi all, Pulling my hair out here. I recently replaced my D: 1TB drive (not a system drive) with a new 1.5TB drive. I loaded Windows XP, formatted the new drive and it was showing as working fine, alongside my C: windows system drive. I restart my machine and all of a sudden, Windows doesn't load and instead I get: "Windows could not start beause the following file is missing or corrupt" \WINDOWS\SYSTEM32\CONFIG\SYSTEM I don't have the original XP installation CD, although I do have another copy of XP, when I try and boot to it, I get the blue 'STOP' screen after it attempts to load the setup utlity for about a minute. Can someone please help? When I set up my new hard drive as a primary partition did this someone screw up my C: hard drive? Did it perhaps unmount it somehow? Any help would be fantastic. Thanks

    Read the article

  • Entering IT field with only hobby experience?

    - by EA Bisson
    I can build computers, install servers, network mac, linux, and windows, build servers, do support etc. I do all of this at home/for friends/for hobbies. I have worked with computers every day since I was in elementary school (commodore 64, windows 3.1 etc.). I have IT bachelors in administrative management (so basically nothing good). I am getting another bachelor's in server admin, including about 5 certifications. I am the IT go to gal at every position usually because I know more than the IT people and have better people skills. My job history is random: office admin, hair braider, disney ride operator, camp counselor etc. I found a job I want its a entry level specialist (server) position. What do I put on a resume?

    Read the article

  • Can iptables allow Squid to process a request, then redirect the response packets to another port?

    - by Dan H
    I'm trying to test a fancy traffic analyzer app, which I have running on port 8890. My current plan is to let any HTTP request come into Squid, on port 3128, and let it process the request, and then just before it sends the response back, use iptables to redirect the response packets (leaving port 3128) to port 8890. I've researched this all night, and tried many iptables commands, but I'm missing something and my hair is falling out. I thought something like this would work: iptables -t nat -A OUTPUT -p tcp --sport 3128 -j REDIRECT --to-ports 8990 This rule gets created ok, but it never redirects anything. Is this even possible? If so, what iptables incantation could do it? If not, any idea what might work on a single host, given multiple remote browser clients?

    Read the article

  • Computer has video artifacts after been exposed to rain

    - by Sadie
    My desktop now displays video artifacts after been exposed to rain. Only a very small amount of moisture went inside the case. The only place I noticed any water was on the CPU socket. I used a hair dryer and paper towels to wick any remaining moisture. When I boot the PC it loads it the OS, but there are large numbers of video artifacts. The artifacts appear symmetric if that helps. I am wondering what components I need to replace. I'd like to salvage what I can. My setup: AMD Athlon x3, Asus main board (AM2 socket), nVidia GT 430 PCIe, 8gb (4gb x2) DDR3

    Read the article

  • Hyper-V 2012 and P2000 SAS SAN

    - by user155950
    Hi I am having major problems setting up a Hyper-V 2012 cluster on a P2000 SAS SAN. Running System Center VMM 2012 SP1 I am unable to see any storage to create my cluster. Has anyone had experienced anything similar? Under fabric and storage I can't add the P2000, all I can do is use storage spaces in server manager to create a storage pool and virtual disk. This allows me to create a file share which I can add to VMM but I still can't see any disk to create a cluster. I am just about at the point where I want to tear my hair out wipe the servers and stick VMware on them because I know it works as I have set several systems up like this in the past. The Hyper-V servers can see the storage and in server manager on my management machine it seems to know both servers can see the same disk. VMM is running on the same machine and it can't see any disk. Help..... Thanks Mike

    Read the article

  • Mighty Mouse is jumping around on screen

    - by Nils Riedemann
    Hi there, I have a really annoying problem with my mighty mouse since a couple of weeks now. When moving my mouse (mightymouse) sometimes it jumps (about once in 30minutes) directly to a (propably) random spot of my screen. I cleaned the mightymouse several times and there is definately no hair or the like, and the desk is not the problem as well - I have the same problem with my other mighty mouse at home. Since I don't have any other mouse i couldn't test whether this relates to the mighty mouse or the mouse in general. Has anyone experienced such issues as well? Is there a solution? Greetings btw: Mac OS X 10.6.4

    Read the article

  • How to stop mouse "pausing".

    - by Xavierjazz
    My Microsoft mouse recently stopped working, so I purchased an AOpen O-35G, plug and play. No software came with it and I was advised to "just plug it in". I did this, and it worked, although some of the more advanced features do not work. My problem is that now the mouse cursor hesitates occasionally, and then over shoots the target I selected. This never happened before. It seems to happen when I am using the mouse and a browser window reloads. Does anyone know how to change this? It is very annoying. XP Pro SP3 Thanks. EDIT: It is not a problem of dust or a hair. I have contacted the Manufacturere and they are not responding. I have the mouse attached to my computer via a powered USB hub. I am going to try plugging it in directly to see if that makes a difference.

    Read the article

  • ISA - Why do i suddenly need to specify settings on the client machines?

    - by user40623
    Have been pulling my hair out over this one for hours, and wondering if someone can help. I have a server with two network interfaces that was running isa 2004 and humming until i installed sbs service pack + isa 2004 service pack 3. Grrrrrrrrrr I can get the client machines to connect to the internet but only by installing the ISA Client on each machine or setting proxy settings etc in the internet settings. Ideally i want the client machines to just work with no configuration or proxy server settings as they were before. Where do i start, and what other information do you need from me if any to find out what im doing wrong Thanks!

    Read the article

  • hp laserjet 4200 madness

    - by C-dizzle
    I have an HP LaserJet 4200 printer that is acting really weird. I can print from internet just fine, no problem... but when I try to print from a document used in microsoft word, for example, I always get "Manual Feed Tray 1". I have racked my brain on this and cannot get it figured out. It's a networked printer and only an administrator account can make changes to it, I have also reset the printer back to factory settings, uninstalled and reinstalled onto the pc's and server it is connected to. Running out of hair since I'm pulling it all out... please help.

    Read the article

  • Storing bundled AMI:s at Amazon EC2

    - by Industrial
    Hi everybody, I am totally new on configuring servers and working with EC2, so please bare with me. I managed after a lot of hair pulling to get a server with Ubuntu up and running with memcached and some other goodies that would make a great package for me. I thought that however, when storing it as an AMI with this tool I would be able to have memcached available next time I launched an instance based upon that image. What can I do to make sure that my configuration is saved properly to an instance? Question number two: - Can I someway make a command that is automatically run on server creation, like initiating memcache with "memcache -d -m 1700 -u root" or even a batch of them?

    Read the article

  • How to have internet connection over VPN while "Microsoft Firewall Client for ISA server" is running

    - by blocked
    I have the software mentioned in the title running on my machine. When I connect over VPN to my company's network, my internet connection gets borked, because somehow the ISA firewall blocks it. This is completely idiotic, because my work involves extensive use of the internet, so having to disconnect and reconnect continuously seriously cripples my productivity. (Meaning: I'm tearing my hair out here.) Can I have my VPN connection and somehow still have my internet connection too? I'm open to any solution.

    Read the article

  • /srv/mm/Music (etc) Twonky won't scan here for media

    - by Hamid
    Is there something special about /srv/mm/ that Twonky server refuses to scan there? I previously had my system set up with all my Music, Video and Photo folders in /srv/mm shared by Samba, miniDLNA etc, with no problems. I came to install Twonky to replace miniDLNA and after two days of tearing my hair out, changing permissions and owners of the directories I ended up making a new directory at /multimedia and moved my Music, Video and Photo folders in there. Twonky then scanned them all straight away with no problems. I'm running Arch Linux (plugapps specifically) on a NAS. The solution is already implemented (moving the directory) I'm just wondering technically why Twonky might have refused to look for my media in the /srv/mm directories.

    Read the article

  • My 386sx refuses to start in cold days

    - by Armadillo
    My old computer refuses to start in cold days. So, in really hot days (about 40ºC / 104ºF ) or even hotter, this PC usually starts, but in cold days, it wont. When the temperature is not in the "sweet-spot" the power light turns on for an half a second and then the computer turns off. But when it's really cold, not even the power light turns on, nor even a blink. Sometimes I use an Hair dryer, pointed directly to the PSU and that works great. 5 to 10 minutes is enough, depending on the ambient temperature. I think something is going wrong in my AT power supply. I can't replace this PSU for another because it has a non-standard size and connectors to power the motherboard. Does anybody have a clue about what it's failing in my PSU, so I can change that component (resistor, capacitor, ??, etc) and rock on with my 80386? Thanks

    Read the article

  • getting a weird error whenever I try restarting apache

    - by Binny Zupnick
    I'm trying to install apache, php5, mysql, and phpmyadmin. And I'm following a tutorial but this error keeps happening here's the error: apache2: Syntax error on line 227 of /etc/apache2/apache2.conf: Could not open configuration file /etc/phpmyadmin/apache.conf: No such file or directory Action 'configtest' failed. The Apache error log may have more information. ...fail! I've tried removing all of them and reinstalling but, to no avail. I'm pulling my hair out over this so, thanks in advance! =) edit: during the tutorial I screwed up and deleting something, lol, so I know that's the issue I just don't know what to do about it now

    Read the article

  • Ubuntu: On a network with many clients there are two machines that can't access the web via a browser at the same time

    - by ChrisInCambo
    Ok I'm pulling my hair out over this one. We have a wireless network with many clients all working well except two Ubuntu clients running 10.10 that can't access the internet via a browser at the same time. They can both still ping, use Skype etc but can't browse. As soon as the one that can browse exits the network browsing returns for the other and vice versa. As ping and Skype was working I assumed some kind of DNS problem but moving over to OpenDNS didn't solve it, nor did restarting networking or using wired rather than wireless. We also switched out the router, and it still persisted so I'm sure this isn't a network issue. The two clients are both laptops and work fine together on a wireless network at another office (which we don't control). I'm thinking something must be cached from the other network they both use that's causing this but have no idea what. Does anyone have any ideas? I just don't know where to go from here.

    Read the article

  • Can I make Windows behave like an ethernet hub?

    - by dromedary
    I have two machines A and C mutually connected to NICs on a third machine, B, as follows: A-B-C B is a Windows 7 machine configured with a bridge containing the A-B and B-C NICs, so that A and C can communicate. So far, so good. I need frames from A destined for B to also arrive at C. Essentially, I would like Windows to behave like a hub rather than a switch. Is there any way to do this? If you have any ideas at all, no matter how hacky or roundabout, I would love to hear from you! I have been tearing my hair out over this and by now I am willing to try anything. My only limitations are that I can't touch A or change to a different operating system on B.

    Read the article

  • Get CruiseControl to talk to github with the correct public key.

    - by Jezmond
    Hi All, Has anybody installed git and ControlControl and got CruiseControl to pull from GitHub on a window 2003 server. I keep getting public key errors (access denied) - Which is good i suppose as that confirms git is talking to github. However what is not good is that I dont not know where to install the rsa keys so they will be picked up by the running process (git in the context of cc.net). Any help would save me a lot of hair! I have tried installing the keys into; c:\Program Files\Git.ssh Whereby running git bash and cd ~ take me to: c:\Program Files\Git Thanks in advance

    Read the article

  • Visual Studio 2008 Crashes When Adding Custom Pipeline Components to Toolbox

    - by Sean Feldman
    I have run into this issue trying to add custom pipeline component to toolbox. The only way (I know about) to add a custom pipeline component to a customized pipeline is using the visual designer. In order to do that you have to have components on toolbox. This was a bit frustrating. Google has brought one result which was exactly what I needed. One of the comments had another link, to the similar issue, but this time with a different title: Hotfix for BizTalk 2009 and Visual Studio 2008. I followed the link, installed hotfix, and it worked. Oh, yes, you have to reboot your machine for hotfix to work completely (this is where I spent some time pulling my hair out and asking why hotfix didn’t work?!). Once this is done, you are good to go. Among other things, this hotfix deals with BizTalk project references to each other and items not being updated (like distinguished fields in schemas project not reflected in orchestrations project). Here’s the full list: * The orchestrations in the referenced BizTalk project may show compiler warnings. * The changes that are made to the referenced BizTalk project are not propagated on to the referencing project. * When you edit the orchestrations of the referenced project, XLANG errors are thrown. These errors may disappear after the orchestrations are saved and recompiled. * After you deploy the referencing project, the local copies of the referenced project’s binaries are deleted. * After you deploy the referencing project, various errors or warnings occur in Orchestration Designer.

    Read the article

  • Passwords in WP7

    - by Richard Jones
    I’ve been trying to protect password entry boxes in Windows Phone 7 (on the emulator) SilverLight supports inputscopes to achieve just this. Peter Foot blogged about this too.  http://mobileworld.appamundi.com/blogs/peterfoot/archive/2010/03/22/windows-phone-7-input.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+PeterFoot+%28Peter+Foot%29 It seems that password inputscope doesn’t quite work yet, please don’t pull your hair out like I just did..   This is the code I was using. <TextBox Height="31" HorizontalAlignment="Left" Margin="240,99,0,0" Name="tbuser" Text="" VerticalAlignment="Top" Width="181" TabIndex="1" >                <TextBox.InputScope>                    <InputScope>                        <InputScope.Names>                            <InputScopeName NameValue="TelephoneNumber"/>                        </InputScope.Names>                    </InputScope>                </TextBox.InputScope>            </TextBox>   Other inputscopes like Telephonenumber work great.  Thought I would blog this to save you from a small bit of pain.

    Read the article

  • Writing to the UI with MonoDroid using RunOnUIThread

    - by Wallym
    I've been pulling my hair out over the past day or so trying to update the UI in my test app.  I was having problem after problem.  I finally got down to my base problem.  I could not write out to my TextView.  WTF could be causing that?  I can write to my UI in other parts of my app.  This is pure craziness.  I thought long and hard and nothing was coming to me.  Wait, the light bulb went on.  I am in the wrong thread.  Great, how do I write in the correct thread?  MonoDroid supports the entire AsyncTask set of objects, but this seemed like overkill.  I was reading and came across RunOnUIThread().......Bing..........The lightbulb has been invented...BlueStar Airlines (oh wait, wrong context). Anyway, here is what I needed:this.RunOnUiThread(() => TextViewControl.Text = "Hello World"); Enjoy!!!!!!!  Remember kiddies, running on the main ui for off device operations is bad, not as bad as crossing the streams bad, but bad as in trying to drive on a flat tire bad. It won't kill you, but it does keep you from getting anywhere.

    Read the article

  • TechEd 2012: Day 3 &ndash; Build Me A Solution

    - by Tim Murphy
    While digesting my lunch it was time to digest some TFS Build information. While much of my time is spent wearing my developer’s hat I am still a jack of all trades and automated builds are an important aspect of any project.  Because of this I was looking forward to finding out what new features are available in the latest release of Team Foundation Server. The first feature that caught my attention is the TFS Admin Client.  After being used to dealing with NAnt in the past it is nice to see a build a configuration GUI that is so flexible and well thought out.  The bonus is that it the tools that are incorporated in Visual Studio 2012 are just as feature rich.  Life is good. Since automated builds are the hub of your development process in a continuous integration shop I was really interested in the process related options. The biggest value add that I noticed was merge gated check-ins.  Merge or batch gated check-ins are an interesting concept.  If the build breaks with all the changes then TFS will run separate builds for each of the check-ins.  This ability to identify the actual offending check-in can save a lot of time and gray hair. The safari of TFS Build that was this session was packed with attractions.  How do you set it up builds, what are the different flavors of builds, how does the system report how the build went?  I would suggest anyone who is responsible for build automation spend some serious time with TFS 2012 and VS2012. del.icio.us Tags: Team Foundation Server 2012,TFS,Build,TechEd,TechEd 2012,Visual Studio 2012

    Read the article

  • Web API, JavaScript, Chrome &amp; Cross-Origin Resource Sharing

    - by Brian Lanham
    The team spent much of the week working through this issues related to Chrome running on Windows 8 consuming cross-origin resources using Web API.  We thought it was resolved on day 2 but it resurfaced the next day.  We definitely resolved it today though.  I believe I do not fully understand the situation but I am going to explain what I know in an effort to help you avoid and/or resolve a similar issue. References We referenced many sources during our trial-and-error troubleshooting.  These are the links we reference in order of applicability to the solution: Zoiner Tejada JavaScript and other material from -> http://www.devproconnections.com/content1/topic/microsoft-azure-cors-141869/catpath/windows-azure-platform2/page/3 WebDAV Where I learned about “Accept” –>  http://www-jo.se/f.pfleger/cors-and-iis? IT Hit Tells about NOT using ‘*’ –> http://www.webdavsystem.com/ajax/programming/cross_origin_requests Carlos Figueira Sample back-end code (newer) –> http://code.msdn.microsoft.com/windowsdesktop/Implementing-CORS-support-a677ab5d (older version) –> http://code.msdn.microsoft.com/CORS-support-in-ASPNET-Web-01e9980a   Background As a measure of protection, Web designers (W3C) and implementers (Google, Microsoft, Mozilla) made it so that a request, especially a JSON request (but really any URL), sent from one domain to another will only work if the requestee “knows” about the requester and allows requests from it. So, for example, if you write a ASP.NET MVC Web API service and try to consume it from multiple apps, the browsers used may (will?) indicate that you are not allowed by showing an “Access-Control-Allow-Origin” error indicating the requester is not allowed to make requests. Internet Explorer (big surprise) is the odd-hair-colored step-child in this mix. It seems that running locally at least IE allows this for development purposes.  Chrome and Firefox do not.  In fact, Chrome is quite restrictive.  Notice the images below. IE shows data (a tabular view with one row for each day of a week) while Chrome does not (trust me, neither does Firefox).  Further, the Chrome developer console shows an XmlHttpRequest (XHR) error. Screen captures from IE (left) and Chrome (right). Note that Chrome does not display data and the console shows an XHR error. Why does this happen? The Web browser submits these requests and processes the responses and each browser is different. Okay, so, IE is probably the only one that’s truly different.  However, Chrome has a specific process of performing a “pre-flight” check to make sure the service can respond to an “Access-Control-Allow-Origin” or Cross-Origin Resource Sharing (CORS) request.  So basically, the sequence is, if I understand correctly:  1)Page Loads –> 2)JavaScript Request Processed by Browser –> 3)Browsers Prepares to Submit Request –> 4)[Chrome] Browser Submits Pre-Flight Request –> 5)Server Responds with HTTP 200 –> 6)Browser Submits Request –> 7)Server Responds with Data –> 8)Page Shows Data This situation occurs for both GET and POST methods.  Typically, GET methods are called with query string parameters so there is no data posted.  Instead, the requesting domain needs to be permitted to request data but generally nothing more is required.  POSTs on the other hand send form data.  Therefore, more configuration is required (you’ll see the configuration below).  AJAX requests are not friendly with this (POSTs) either because they don’t post in a form. How to fix it. The team went through many iterations of self-hair removal and we think we finally have a working solution.  The trial-and-error approach eventually worked and we referenced many sources for the information.  I indicate those references above.  There are basically three (3) tasks needed to make this work. Assumptions: You are using Visual Studio, Web API, JavaScript, and have Cross-Origin Resource Sharing, and several browsers. 1. Configure the client Joel Cochran centralized our “cors-oriented” JavaScript (from here). There are two calls including one for GET and one for POST function(url, data, callback) {             console.log(data);             $.support.cors = true;             var jqxhr = $.post(url, data, callback, "json")                 .error(function(jqXhHR, status, errorThrown) {                     if ($.browser.msie && window.XDomainRequest) {                         var xdr = new XDomainRequest();                         xdr.open("post", url);                         xdr.onload = function () {                             if (callback) {                                 callback(JSON.parse(this.responseText), 'success');                             }                         };                         xdr.send(data);                     } else {                         console.log(">" + jqXhHR.status);                         alert("corsAjax.post error: " + status + ", " + errorThrown);                     }                 });         }; The GET CORS JavaScript function (credit to Zoiner Tejada) function(url, callback) {             $.support.cors = true;             var jqxhr = $.get(url, null, callback, "json")                 .error(function(jqXhHR, status, errorThrown) {                     if ($.browser.msie && window.XDomainRequest) {                         var xdr = new XDomainRequest();                         xdr.open("get", url);                         xdr.onload = function () {                             if (callback) {                                 callback(JSON.parse(this.responseText), 'success');                             }                         };                         xdr.send();                     } else {                         alert("CORS is not supported in this browser or from this origin.");                     }                 });         }; The POST CORS JavaScript function (credit to Zoiner Tejada) Now you need to call these functions to get and post your data (instead of, say, using $.Ajax). Here is a GET example: corsAjax.get(url, function(data) { if (data !== null && data.length !== undefined) { // do something with data } }); And here is a POST example: corsAjax.post(url, item); Simple…except…you’re not done yet. 2. Change Web API Controllers to Allow CORS There are actually two steps here.  Do you remember above when we mentioned the “pre-flight” check?  Chrome actually asks the server if it is allowed to ask it for cross-origin resource sharing access.  So you need to let the server know it’s okay.  This is a two-part activity.  a) Add the appropriate response header Access-Control-Allow-Origin, and b) permit the API functions to respond to various methods including GET, POST, and OPTIONS.  OPTIONS is the method that Chrome and other browsers use to ask the server if it can ask about permissions.  Here is an example of a Web API controller thus decorated: NOTE: You’ll see a lot of references to using “*” in the header value.  For security reasons, Chrome does NOT recognize this is valid. [HttpHeader("Access-Control-Allow-Origin", "http://localhost:51234")] [HttpHeader("Access-Control-Allow-Credentials", "true")] [HttpHeader("Access-Control-Allow-Methods", "ACCEPT, PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK, PUT, GETLIB, VERSION-CONTROL, CHECKIN, CHECKOUT, UNCHECKOUT, REPORT, UPDATE, CANCELUPLOAD, HEAD, OPTIONS, GET, POST")] [HttpHeader("Access-Control-Allow-Headers", "Accept, Overwrite, Destination, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control")] [HttpHeader("Access-Control-Max-Age", "3600")] public abstract class BaseApiController : ApiController {     [HttpGet]     [HttpOptions]     public IEnumerable<foo> GetFooItems(int id)     {         return foo.AsEnumerable();     }     [HttpPost]     [HttpOptions]     public void UpdateFooItem(FooItem fooItem)     {         // NOTE: The fooItem object may or may not         // (probably NOT) be set with actual data.         // If not, you need to extract the data from         // the posted form manually.         if (fooItem.Id == 0) // However you check for default...         {             // We use NewtonSoft.Json.             string jsonString = context.Request.Form.GetValues(0)[0].ToString();             Newtonsoft.Json.JsonSerializer js = new Newtonsoft.Json.JsonSerializer();             fooItem = js.Deserialize<FooItem>(new Newtonsoft.Json.JsonTextReader(new System.IO.StringReader(jsonString)));         }         // Update the set fooItem object.     } } Please note a few specific additions here: * The header attributes at the class level are required.  Note all of those methods and headers need to be specified but we find it works this way so we aren’t touching it. * Web API will actually deserialize the posted data into the object parameter of the called method on occasion but so far we don’t know why it does and doesn’t. * [HttpOptions] is, again, required for the pre-flight check. * The “Access-Control-Allow-Origin” response header should NOT NOT NOT contain an ‘*’. 3. Headers and Methods and Such We had most of this code in place but found that Chrome and Firefox still did not render the data.  Interestingly enough, Fiddler showed that the GET calls succeeded and the JSON data is returned properly.  We learned that among the headers set at the class level, we needed to add “ACCEPT”.  Note that I accidentally added it to methods and to headers.  Adding it to methods worked but I don’t know why.  We added it to headers also for good measure. [HttpHeader("Access-Control-Allow-Methods", "ACCEPT, PROPFIND, PROPPA... [HttpHeader("Access-Control-Allow-Headers", "Accept, Overwrite, Destin... Next Steps That should do it.  If it doesn’t let us know.  What to do next?  * Don’t hardcode the allowed domains.  Note that port numbers and other domain name specifics will cause problems and must be specified.  If this changes do you really want to deploy updated software?  Consider Miguel Figueira’s approach in the following link to writing a custom HttpHeaderAttribute class that allows you to specify the domain names and then you can do it dynamically.  There are, of course, other ways to do it dynamically but this is a clean approach. http://code.msdn.microsoft.com/windowsdesktop/Implementing-CORS-support-a677ab5d

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >